Game Development Community

[beta5 bug] Ray casts in debris can crash T3D (w/ fix)

by Ivan Mandzhukov · in Torque 3D Professional · 09/03/2009 (11:39 am) · 0 replies

I create a trigger.
When player enters the trigger i generate in runtime 50 explosions with bounce(just to enable castray calls).
We have a crash here.
I am using it on a Polysoup,that's why we add StaticTSObjectType as a part of csmStaticCollisionMask.
const U32 csmStaticCollisionMask =  TerrainObjectType | StaticTSObjectType |
                                    InteriorObjectType;

Ok, i see that explosions are not optimized to be created on server(on the fly),thats why we create 50 projectiles,that creates them.
Same crash.

Obviously in debris.cpp:
if( getContainer()->castRay( curPos, extent, collisionMask, &rayInfo ) )
   {...
gives the error.



When i replaced with this:
Container* pContainer = isServerObject() ? &gServerContainer : &gClientContainer;
   if( pContainer->castRay( curPos, extent, collisionMask, &rayInfo ) )
   {...
now all is good.
Even the serverside explosions work flawlessly.
I tested over 500 explosions,i got 2 fps - engine is stable.