implicit downcast 'Object' to "UnityEngine.Quaternion"

I know the warning comes from not explicitly saying what type of thing each thing is but i cant fix this one

it says the problem is here

    transform.rotation = Quaternion.Slerp(transform.rotation, neededRotation, Time.deltaTime * 3);

The error says that the variable "neededRotation" is of type Object. It has to be a Quaternion for the slerp function to work.

It's telling you that neededRotation isn't a rotation, despite the name (Quaternion is the official name for rotations.) Show where you declare/compute needRot.

i tried adding the variable type and it didnt seem to help private var neededRotation : Quaternion; then function Start () { neededRotation = transform.rotation; } i also set the rotation with a raycast hit neededRotation = Quaternion.LookRotation(hit.transform.position+Vector3(.75,0,0) - transform.position); i dunno which thing it's unhappy with

1 Answer

1

ugh i found my issue, there is one spot where i set my neededRotation variable to the origRot and i needed to define BOTH as Quaternions to make the warning go away, it just wasnt pointing to the exact problem area, o_o

thanks peeps for pointing me in the right direction