Hi, i create a game, where you controling a bird and let him fly do different directions. The bird has a fixed start point and the end point is always the point, the player klicking at. The gamemechanics are using ".lerp" and working well. But how can i create a function, that takes care, that the picture of the gamecharacter is always beeing rotatet in the correct angle for the current "flight" ? ( You never know in which direction and angle the player is controling the bird)
Use Quaternion.LookRotation to find the desired rotation. Quaternion also has a lerp function if you want it to happen smoothly.
Thank you very much. Strange that my Gameobject dissapears when i use "Look Rotation".. But i hope i will get it to work.
The various "look" functions do not work for 2D Sprites; they point the Z-axis, which inevitably makes the Sprite edge-on to the camera, therefore "disappearing" as it has no width. Instead you'll have to use Mathf.Atan2.
Hmm ok, i cant work with rotating by an angle. I have to many possibilities in my game and the angle just works for a certain "fly position". Is there no way to make use of "rotate towards and certain point?