Vector3.RotateTowards issues

I am trying to get a 2D object to to rotate towards my mouse (not lookAt), but it won’t rotate regardless of what I put for RadiansDelta and MagnitudeDelta. Here is the code:

void Update () {
Vector3.RotateTowards (transform.rotation.eulerAngles, target.transform.position, Mathf.Deg2RadturnRateTime.deltaTime, 1f);
}

RotateTowards returns a new Vector3 which is an interpolation between the first two parameters.

You need to assign it:
“transform.rotation.eulerAngles = Vector3.RotateTowards(…);”

1 Like