RenderCollisionBounds
by Dave DAmico · in Torque X 2D · 09/02/2008 (7:17 am) · 7 replies
If I set the RenderCollisionBounds value of my object equal to true, I get a NullReferenceException in the Draw method. Does anyone have an example on how to get this to work? Here is my object:
<TorqueObject type="GarageGames.Torque.Core.TorqueObject" name="TrainingRoomDesk">
<Components>
<SceneComponent type="GarageGames.Torque.T3D.T3DSceneComponent" name="roomSceneComponent">
<Position>
<X>0</X>
<Y>200</Y>
<Z>350</Z>
</Position>
</SceneComponent>
<XNARenderComponent type="GarageGames.Torque.T3D.T3DXNARenderComponent" name="compRender">
<Filename>data/shape/TrainingRoomDesk</Filename>
</XNARenderComponent>
<RigidComponent type="GarageGames.Torque.T3D.T3DRigidComponent" named="deskRigidComponent">
<RenderCollisionBounds>true</RenderCollisionBounds>
<CollisionShapes>
<CollisionShape>
<Shape type="GarageGames.Torque.T3D.RigidCollision.CollisionBoxShape">
<Bounds>
<min>
<x>-50</x>
<y>-50</y>
<z>-50</z>
</min>
<min>
<x>50</x>
<y>50</y>
<z>50</z>
</min>
</Bounds>
<Center>
<X>0</X>
<Y>200</Y>
<Z>350</Z>
</Center>
</Shape>
</CollisionShape>
</CollisionShapes>
<GravityScale>0.0</GravityScale>
<Immovable>true</Immovable>
<RigidManager nameRef="RigidManager" />
</RigidComponent>
</Components>
</TorqueObject>About the author
#2
09/02/2008 (7:31 am)
Are you saying the rendering of the bounding box has an issue... or using the bounding box in general has an issue?
#3
http://www.garagegames.com/mg/forums/result.thread.php?qt=76940
Through the xml, you should be ok. In my project, I use:
09/02/2008 (7:59 am)
Using the bounding box in general is ok, its the rendering that has issue. In the private forums, there is several discussions on it, and I believe it will be fixed in the next point release. I ran into this issue when I tried to do it programmatically instead of through xml. You can see a thead on it here:http://www.garagegames.com/mg/forums/result.thread.php?qt=76940
Through the xml, you should be ok. In my project, I use:
<RigidComponent type="GarageGames.Torque.T3D.T3DRigidComponent">
<SceneGroupName>PlayerMesh</SceneGroupName>
<RenderCollisionBounds>true</RenderCollisionBounds>
<ResolveCollisions>true</ResolveCollisions>
<CollisionShapes>
<CollisionShape>
<Shape type="GarageGames.Torque.T3D.RigidCollision.CollisionSphereShape">
<Radius>2.00</Radius>
<Center>
<X>0.0</X>
<Y>-0.2</Y>
<Z>0.65</Z>
</Center>
</Shape>
</CollisionShape>
</CollisionShapes>
<Kinetic>true</Kinetic>
<RotationScale>0.0</RotationScale>
<Mass>30</Mass>
<GravityScale>1.5</GravityScale>
<RigidManager nameRef="RigidManager" />
</RigidComponent>
#4

I used this xml:
09/02/2008 (8:10 am)
I used your xml minus the bounds, and it seems to render ok:
I used this xml:
<CollisionShapes>
<CollisionShape>
<Shape type="GarageGames.Torque.T3D.RigidCollision.CollisionBoxShape">
<Center>
<X>0</X>
<Y>0</Y>
<Z>0</Z>
</Center>
</Shape>
</CollisionShape>
</CollisionShapes>
#5
09/02/2008 (8:30 am)
I removed the bounds and i still get the error...
#6
Should that be
09/02/2008 (10:16 am)
Not sure if this matters, but I noticed this in your xml:<RigidComponent type="GarageGames.Torque.T3D.T3DRigidComponent" named="deskRigidComponent">
Should that be
<RigidComponent type="GarageGames.Torque.T3D.T3DRigidComponent" name="deskRigidComponent">
#7
09/05/2008 (2:18 pm)
Is your model in DTS format?
Torque Owner David Everhart