Question : Rotate player to next waypoint with smoothly (DOTween)

Hello guys, I’m stuck when i want to rotate my player.

Let me explain my movement. Player start on waypoint1. When player kill enemy at next waypoint player move this waypoint but this waypoint could be at right or left with different angle. I want rotate my player when reach different angle waypoint.
To this im using this line but my player wont turn any angle? What i missing thanks

GGun.instance.playerObject.transform.DORotate(new Vector3(newWayPoints[current + 1].wayPoint.transform.rotation.x,
newWayPoints[current + 1].wayPoint.transform.rotation.y,
newWayPoints[current + 1].wayPoint.transform.rotation.z), 10f);

There is no possible way anybody human can reason about that single line of code.

Break it up into single-statement lines assigning each result to a meaningfully-named intermediate variable, otherwise you will never figure it out except perhaps by chance.

Well how its look like now ? :smile:

I rotate my player with

GGun.instance.playerObject.transform.rotation = newWayPoints[current + 1].wayPoint.transform.rotation;

but i want it with smooth animation :smile: for this i use DOTween but DORotate is not working. Its not rotate. My movement and rotating with no smooth is working perfecly

Close this scene, make a fresh scene, make two objects and iterate until you figure out why DOTween is not DORotating. When you figure that out, go apply the knowledge back to your game.

1 Like

Well in empty scene, Its not complete rotating to target object. Now i belive DORotate is not working right :smile:

This is possible, but remember that package has been around a long time. It might be more useful to look for examples of using this package to do exactly what you are doing.

There is not enough tuts or resources for using of DORotate but i found when digged. They are do same with me but i cant work it properly.

I set target rotation.y = - 90
I set my player rotation.y = target.y

when i run, player only turn at y -0.707 :smile:

There is no child no local pos. Cant understand this problem.