Game Development Community

CollisionBoxShape wierd behaviour

by Trent · in Torque X 3D · 01/13/2010 (9:18 am) · 2 replies

If I place my player at 0,0,0 and my enemy at +800 Y (doesn't have to be 800, just a larger distance), facing +Y then run my simulation, it flies forward and turns left to try and face the player, all the while calling CollisionScene.CastRay(). My player has a single CollisionBoxShape { Size = new Vector3(20, 20, 5) }. When I finally get a collision, the intersection is at {X:-9.999992 Y:-185.9471 Z:0}. I don't understand how this happens. It sort of seems like it is treating some of the sides as infinite planes, but not all of them. I'm no math expert so this one is gonna be hard for me to debug.

Now, if I face the enemy at the player (-Y), the intersection happens at 0,10,0 as I expect. If put my ship at -800 Y facing the player (+Y), the intersection is at 0,-10,0, as I expect.

It appears that CollisionSphereShape works as expected.

#1
01/16/2010 (1:42 am)
This sounds very strange, indeed. I'll take a peek at the CastRay() method to see if anything odd stands out.

John K.
#2
01/16/2010 (2:10 am)
Thanks John, much appreciated.