# Tag Info

## New answers tagged rotation

0

You describe your problem rotating a cube, but it seems to me that you are having the camera orbit around the cube. However, the vectors you are using for the axes of rotation are in world space, and do not rotate with the camera. After you have rotated left by 90 degrees, Vector3.left is now facing directly into the camera. As such, your next swipe for a "...

1

Sounds like you are working with step motors which will take a rotation along a fixed axis. Not an answer to your question but an alternative I have used successfully: Work with spherical coordinates (pitch and yaw) to match your two motors on the x and y axis? Keep your direction heading as a vector (pointing in the direction you are gazing). BTW, a ...

-1

In a game I'm working on, I have bullets capable of automatically moving towards the closest enemy you're aiming at. They detect the enemy once only when the bullet is create, then start moving at finite speed and correct their direction when the enemy changes position. To fit your case, we can assume the enemy position in my script with the mouse ...

1

Your main problem is that you did not account for the discontinuity in the arctangent function... // Check if arctangent has crossed the discontinuity if (delta < -Math.PI || (delta > 0 && delta < Math.PI)) { And you are not reducing the player rotation into a canonical -Pi <= x < Pi range. // Reduce player.r into the -PI thru PI ...

Top 50 recent answers are included