Game Development Community

Terrain RenderCollisionBounds

by Scott Goodwin · in Torque X 3D · 12/18/2009 (9:41 pm) · 0 replies

I wanted to make RenderCollisionBounds work for terrains so I first added a setter for Material in CollisionShape so I could set it to a new SimpleMaterial with IsWireframe = true.

Then in XTerrain.Render, I added
// temporary test code ... obviously don't want to be doing this find in Render!
if (Components.FindComponent<T3DRigidComponent>().RenderCollisionBounds)
{
  var rotationOnly = Matrix.CreateFromQuaternion(Quaternion.Identity);
  CollisionMesh.RenderBounds(srs, ref rotationOnly);
}

Then I used XTerrain.TerrainChunk.UseTestMaterial = true;
so the terrain would also render as wireframe.

Anyway, to make a long story short, the collision mesh looks wrong ... I suspect it is not the mesh that is wrong but either my understanding of what it should look like (i.e. look like the terrain wireframe except for LOD) or the RenderBounds method in CollisionMeshShape is wonky.

Anybody want to try this and offer insights?