Page MenuHome

Fixed creation of navigation mesh with multiple objects
ClosedPublic

Authored by Thomas Trocha (dertom) on Dec 26 2017, 2:02 AM.

Details

Summary

Creation of a navigation mesh with multiple objects was broken.
(the fix is a oneliner)

How to reproduce:

  1. go "blender-game"
  2. create a scene with more multiple objects e.g. one plane with multiple cubes that intersect the plane
  3. Scene Properites>Naviation Mesh>"Build Navigation Mesh"

> wrong navmesh

Joining all objects into one and creating the navmesh with the same steps as before do work.

Solution:
So there must be something wrong with the intermediate-mesh created for recast.
This creation has two steps.

  1. create derived mesh with vertices for each object
  2. create tris with the vertices in these DMs for every object

The problem was that the order got wrong. The DMs were pre(!)pended to the derived mesh list, so it happens that
as soon as you have more than one object you create tris with vertices of another object. Appending the DM in the
list did the job to keep the right order.

As reviewers I added the last three committers.

Greetings, dertom

Diff Detail

Repository
rB Blender

Event Timeline

Thomas Trocha (dertom) edited the summary of this revision. (Show Details)
Campbell Barton (campbellbarton) requested changes to this revision.EditedJan 26 2018, 1:13 AM

This doesn't compile.

/src/blender/source/blender/editors/mesh/mesh_navmesh.c: In function ‘createVertsTrisData’:
/src/blender/source/blender/editors/mesh/mesh_navmesh.c:88:23: error: passing argument 1 of ‘BLI_linklist_append’ from incompatible pointer type [-Werror=incompatible-pointer-types]
   BLI_linklist_append(&dms, dm);
                       ^

Could you update the patch and include a simple test file?

This revision now requires changes to proceed.Jan 26 2018, 1:13 AM

Fixed BLI_linklist_append-usage.

Oh wow, you are right. It compiled and worked for me but with warning. Now I do use BLI_linklist_append as intended with a LinkNodePair.

Can you plz double-check if the memory cleaning up is done right.

I appended a simple Test. Just select all objects and press "Build Navigation Mesh"

This revision is now accepted and ready to land.Jan 26 2018, 3:11 AM