Relocating Graph

HomeForumsA* Pathfinding ProjectSupportRelocating Graph

This topic has 2 voices, contains 1 reply, and was last updated by  Aron Granberg 81 days ago.

Viewing 2 posts - 1 through 2 (of 2 total)
Author Posts
Author Posts
February 22, 2012 at 20:44 #1548

Beck

Hi,
I am using a grid graph for my project which I need to relocate at times during runtime. I have been trying to use RelocateNodes but I’m not entirely sure how it works (the documentation on this function seems sparse). I essentially need to offset the entire graph along one axis by a float value.
I have tried sending it TRS matrices but so far I have not had any success. I am not sure what Old Matrix and New Matrix represent. Is Old Matrix something I can access from the grid graph which already exists?

Thanks,
-Beck

February 27, 2012 at 12:38 #1571

Aron Granberg

I haven’t used the RelocateNodes function for some time.
But looking at the code it looks like the newMatrix is the only one used for NavMesh Graphs. It describes the offset to apply to the mesh’s vertices from the original vertices got from the mesh data.

The navmesh graph internally constructs the matrix like this:
matrix = Matrix4x4.TRS (offset,Quaternion.Euler (rotation),new Vector3 (scale,scale,scale));

For other graphs, like Grid Graph. The “old matrix” is the matrix the nodes are currently offset by.
The current matrix can be got by myGraph.matrix which is stored for all graphs (perhaps not List Graphs though…).
However, it seems there is a but when working with Grid Graphs. See here: http://www.arongranberg.com/forums/topic/relocate-nodes-fix/
Got to fix that bug.

You should call it after scanning, i.e in Start or Update, not Awake.

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Relocating Graph
Your information:






<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>