Issues with navigator

Dec 11, 2012 at 12:03 AM


I'm having an issue getting the basic steering behaviors working correctly in 1.4. When using the Navigator.MoveTo() method I can get the unit to move correctly along the the X axis but it seems to get stuck moving along the Z axis and also faces the wrong way.

Have there been updates the steering library since the Y became the up axis? Could this be the issue or is it something in my code? I had basic samples working in the previous version of Nine so I'm not sure what I'm doing wrong.

// Call to UnitController      
private void MoveTo(int destination)
     var dest = graph.IndexToPosition(destination);

      controller.MoveTo(new Vector3(dest.X, dest.Y, 0));

// UnitController
public void MoveTo(Vector3 pos)

protected override void Update(TimeSpan elapsedTime)

    model.Transform = Matrix.Identity * Navigator.Transform;


Dec 11, 2012 at 12:56 AM
Edited Dec 11, 2012 at 7:58 AM
Sorry to say that the navigation lib was not updated with the graphics lib. Physics and navigation are not as mature as graphics :'(
Dec 11, 2012 at 2:33 AM

OK fair enough. I thought I should check before I spend time looking into the issue.

Do you have a road map for when these components will be updated?

Dec 11, 2012 at 7:35 AM


Dec 14, 2012 at 1:53 AM
Edited Dec 14, 2012 at 2:40 AM


I had a bit of a poke around into the steering code and realised that since the actual steering logic is all in 2D it must just be an issue converting to 3D space. It turned out to be the object facing translation that was causing the problem.

In the Navigator::Update method I changed:

Vector3 facing = new Vector3(steerable.Forward, 0);


Vector3 facing = new Vector3(steerable.Forward.X, 0, -steerable.Forward.Y);

That seemed to fix the issue for me. I haven't tested much except with basic Seek behavior on flat terrain but just thought I would let you know.

Edit - also had to update the rotation offset logic:


float rotationOffset = (float)Math.Atan2(facing.Y, facing.X) - Rotation;
float rotationOffset = (float)Math.Atan2(facing.Z, facing.X) - Rotation;



Dec 14, 2012 at 3:07 AM

Thanks for the help!!

Dec 14, 2012 at 3:46 AM

The one thing I'm not too sure about though is why I had to flip the Z axis to a negative value. The positive Z axis should have been the same as the old Y value right? So maybe I'm missing something...

Dec 14, 2012 at 4:30 AM

It's because the Y axis for the heightmap has flipped.