Quantcast
Channel: Answers by "thelackey3326"
Viewing all articles
Browse latest Browse all 30

Answer by thelackey3326

$
0
0
Expanding on what iwaldrop said: Lines 19 and 25 are where the problem lies. There it looks like you are trying to interpolate ("lerp") a rotation, which is a Quaternion. The error is that you are using *Vector3.Lerp()* where you should be using *Quaternion.Lerp()*. transform.localRotation = Vector3.Lerp(transform.localRotation, AimRot, AimSpeed * Time.deltaTime); For line 19, it should probably be: transform.localRotation = Quaternion.Lerp(transform.localRotation, Quaternion.Euler(AimRot), AimSpeed * Time.deltaTime); **Just as a side note** Something you should keep in mind is that passing the value you want to interpolate as the *from* value will mean that the difference between from and to will become infinitely small but, theoretically, never quite reach zero. The effect is that the lerp will slow down over time but will never complete (if complete is the right word). It's not invalid, but it may not be the desired effect.

Viewing all articles
Browse latest Browse all 30

Trending Articles