Movement pack - Patrol rotation in 2d world

Lemar

New member
Hi,

Thank you for your awesome work. I was playing around with a 2d setup, unity navMesh, top down and used the patrol task from the movement pack. The movement is working, my sprite can move between waypoint but the rotation that can be activated within that task does not work as is does rotate around the wrong axis.

What would be an appropriate solution for the rotation to work for 2d?

I got it to work with a second behavior tree and the rotate towards task as this task supports explicitly 2d world rotation.

So my question is, is this how I'm supposed to solve the rotation or how does an alternative solution looks like?

Cheers
Lemar
 
When the patrol task is moving towards a destination it will use the agent's Up vector in order to determine the rotation. Looking at the code though (NavMeshMovement.Update) it does assume that the rotation will always be relative to the local y axis so this won't always work. For a top down game it should though - is your world arranged so up is Vector3.up?
 
Thank you, I figured it out. Had to adjust the gameobject preset rotation and camera aligned with z,x Axis. It works now fine.
 
Top