Hi there,
After our game hanged several times when an agent couldn't find a position on
on the navmesh, I started digging into your code and found an uninitialized
array of floats in DetourCrowd.cpp:dtCrowd::addAgent.
findNearestPoly() doesn't necessarily initialize nearestPt, leaving nearest[]
uninitialized.
I solved it by initializing nearest[] to pos[].
Diff below!
Cheers,
Martijn
Index: DetourCrowd.cpp
===================================================================
--- DetourCrowd.cpp (revision 7928)
+++ DetourCrowd.cpp (revision 7929)
@@ -523,6 +523,9 @@
// Find nearest position on navmesh and place the agent there.
float nearest[3];
+ dtVcopy(nearest, pos); // Two Tribes Addition: make sure nearest[] is
initialized to a sensible value
+ // because findNearestPoly() doesn't necessarily
initialize nearestPt, leaving nearest[]
+ // uninitialized.
dtPolyRef ref;
m_navquery->findNearestPoly(pos, m_ext, &m_filter, &ref, nearest);
Original issue reported on code.google.com by mreuvers...@gmail.com on 3 Jan 2013 at 2:52
Original issue reported on code.google.com by
mreuvers...@gmail.com
on 3 Jan 2013 at 2:52