Hey all,
So I’m trying to rotate my sprite based on the mouse location i.e if the mouse is to the left of the sprite the sprite faces left, and if the mouse is to the right of the sprite the sprite faces to the right.
The code works, but its making my game really choppy, the sprite doesn’t run at its maxSpeed, or jump to its max height, and doesn’t fall as fast as gravity…all in relation to before I added this mouse look thing.
// calculate the angle of vector from the mousePosition to the spritePosition in relation to the y-axis
//clamp the y rotation so it stays 2D
if(angle <90 )
angle = 0;
else
angle = 180;
transform.rotation = Quaternion.Euler(0,angle,0);
This is how I implement it…if I were to comment out the rotation, my sprite moves,jumps,and falls at normal speeds. But when the line is active…is slows all those thing. Could anyone point me in the direction of why this is happening?