Problem with custom vehicle class and getBinRange
by Marc-Andre Vachon · in Torque 3D Professional · 10/30/2014 (9:30 am) · 2 replies
I'm having an issue running my game in debug for a long time and I'd like to fix it but can't figure how. I had start a thread last year to try to solve it with community help but for mysterious reason, my GG account got removed from DB and I lost all my previous posting...
Today I have start digging the issue and I have resolve half of it but some getBinRange Assert still happen. The "half" fix was related to my suspension castRay which was too long. I'm still not familiar with the Bins and objects box but am I correct to assume that a castRay must happen inside of Bounds? Or is it what's the query box is for?
So now, I still have a problem with my vehicle position update, I get some NaN values in my mRigid and mConvex object which cause the castRay to fail. What I find strange is that the game seem to run fine using optimized debug or release. I'm wondering if I simply need to change something related to the "bin" code which I'm still not sure what it does...
Here's some screenshot of my problem from C++ after I break it.
mRigid and currTransform watches showing NaN values:

Here's the Assert warning I got (I changed them from AssetFatal for better debugging)

Here's my castRay call which start the bin problem (As expected with the corrupted currTransform NaN values)

I'd really like to get over this issue but I really don't know where to look... Any help would be greatly appreciated to help me getting through it. I'd like to understand more what is the "bin" and how it work. What can possibly cause those NaN?
Ok, thanks for reading and I'm hoping someone can enlighten me a bit more about what's happening.
Today I have start digging the issue and I have resolve half of it but some getBinRange Assert still happen. The "half" fix was related to my suspension castRay which was too long. I'm still not familiar with the Bins and objects box but am I correct to assume that a castRay must happen inside of Bounds? Or is it what's the query box is for?
So now, I still have a problem with my vehicle position update, I get some NaN values in my mRigid and mConvex object which cause the castRay to fail. What I find strange is that the game seem to run fine using optimized debug or release. I'm wondering if I simply need to change something related to the "bin" code which I'm still not sure what it does...
Here's some screenshot of my problem from C++ after I break it.
mRigid and currTransform watches showing NaN values:

Quote:Before my castRay lenght fix, the mConvex and mDelta were showing NaN also
Here's the Assert warning I got (I changed them from AssetFatal for better debugging)

Here's my castRay call which start the bin problem (As expected with the corrupted currTransform NaN values)

I'd really like to get over this issue but I really don't know where to look... Any help would be greatly appreciated to help me getting through it. I'd like to understand more what is the "bin" and how it work. What can possibly cause those NaN?
Ok, thanks for reading and I'm hoping someone can enlighten me a bit more about what's happening.
About the author
Silent Torque developper since 2007 (T3D/TGEA) that is trying to start his little independant studio called Nordik Lab. --"Simple is Better"--
#2
Anyone know what can cause such error to happen on DEBUG only? I will try to find where it start to go wrong on DEBUG but I'm not sure how to proceed, maybe simply adding more console logs in suspicous code areas...
Is there a T3D Debug function that could help me with that?
11/04/2014 (1:42 pm)
Thanks for the reply! I will continue my investigation today and try to find where it start to go bad. The strange thing is that it only happen using DEBUG setup. I have no issue with RELEASE and OPTIMIZED_DEBUG with little rare exception that the NaN issue appear in release build after bad vehicle spawning. For sure I don't have the assertwarning in those builds but there's a console print log for when the values are not okay. Those logs appear as soon as my vehicle spawn in DEBUG but very rarely on other build.Anyone know what can cause such error to happen on DEBUG only? I will try to find where it start to go wrong on DEBUG but I'm not sure how to proceed, maybe simply adding more console logs in suspicous code areas...
Is there a T3D Debug function that could help me with that?
Associate Chris Haigler
Jester Dance
For spatial queries (like ray casts), only the objects in the effected bins are checked. This is a performance improvement over checking every object in the scene.
As far as your issue, assuming you're setting startPos & endPos correctly, it's probably going to be an error further up the callstack. Some divide by 0 error, or maybe an issue with packet sync, etc. It almost looks like the vehicle isn't being added to the scene/ghosted properly.