I’ve been looking around and even if I use the exact code people are using I still can’t get this to work for the life of me so I’ve been just working on my own code to no avail
public float speed;
private Transform CurrentPos;
void Start() {
CurrentPos = transform.rotation;
}
void OnColisionEnter ()
{
CurrentPos = Quaternion.Slerp(CurrentPos, Quaternion.Euler(0,90,0), Time.deltaTime * speed);
}
I get an error after start on line 5
CurrentPos = transform.rotation;
error CS0029: Cannot implicitly
convert typeUnityEngine.Quaternion' to
UnityEngine.Transform’
I then get 2 errors on line 10
CurrentPos = Quaternion.Slerp(CurrentPos, Quaternion.Euler(0,90,0), Time.deltaTime * speed);
The best overloaded method match for
`UnityEngine.Quaternion.Slerp(UnityEngine.Quaternion,
UnityEngine.Quaternion, float)’ has
some invalid arguments
error CS1503: Argument
#1' cannot convert
UnityEngine.Transform’
expression to type
`UnityEngine.Quaternion’
No matter how I try to approach it I get errors, I can’t seem to grasp Quaternion by the looks of it, I have tried setting it to Transform.Rotation,Y = 90 as the target position but I still get errors
I understand that Quaternion uses X,Y,Z,W but it even says on the Scripting API that you can use Quaternion.Euler which gives a Vector3 and you still get an error
I feel unity API could explain these a lot better, from what I’m reading none of the methods seem to work