- Home /
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
Answer by TimBorquez · Nov 20, 2013 at 03:34 PM
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
Your answer
![](https://koobas.hobune.stream/wayback/20220613122138im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
SendMessage cannot be called during Awake, CheckConsistency, or OnValidate 0 Answers
Quarternion Rotation 1 Answer
My Obstacle Rotations Are Not Correct 0 Answers
error CS0649 1 Answer