- Home /
rotate object to waypoints rotation
Hi guys,
I know there are a lot of questions out there how to rotate a object from one waypoint to another. But I'm making a sport game, and now I would like to make a high jump game, so my problem is, that the gameobject should not face to the next waypoint, it should get smoothly to the same rotation as the next waypoint is
so to make it a bit clearer my first waypoint has the coordinates 0,0,0 with a y rotation of -90 the second waypoint is on 0,0,1 with a y rotation of -90 and the thrid waypoint is on 1,0,1 with a y rotation of -180
so after that my gameobject should have a y rotation of -180 and not of 0.
i hope this was clear enough and someone could help me
this is my actual rotation code, but obviously after the rotation the object faces to the next waypoint
transform.position = Vector3.MoveTowards (
transform.position,
points [currentWaypointID].position,
speed * Time.deltaTime);
transform.rotation = Quaternion.Slerp (
transform.rotation,
Quaternion.LookRotation(
points[currentWaypointID].position - transform.position),
rotationSpeed * Time.deltaTime);
Answer by hexagonius · Jun 22, 2017 at 12:32 AM
Just slerp to the waypoints rotation. points[currentWaypointID].rotation
ok after that simple solution i feel realy bad xD
but thanks for your fast answer
Your answer

Follow this Question
Related Questions
iTween and 2D Platforming Tutorial Merge: Rotation of player and camera needed 1 Answer
Keep rotation at (0,0,0) while transforming? 1 Answer
What's causing my NPC Controller to invert? Please Help!! 0 Answers
Rotate overtime to match waypoint 1 Answer
Enemy Not Facing target direction (waypoint) correctly when moving between waypoints 1 Answer