Game Development Community

Fix for RenderCollisionBounds

by Sean T. Boyette · in Torque X 2D · 11/12/2008 (8:21 pm) · 2 replies

Zilla asked for the fix for RenderCollisionBounds

In public static RenderMaterial Material


I replaced

_material = new LightingMaterial(); //- Changed to support renderbounds


with

//_material = new LightingMaterial(); //- Changed to support renderbounds

_material = new SimpleMaterial();

_material.IsWireframe = true;


In CollisionSphereShape : CollisionShape add

public override void RenderBounds(SceneRenderState sceneRenderState, ref Matrix rotationOnly)

{

T3DSphereMesh sphere = new T3DSphereMesh(2);

sphere.Center = _center;

sphere.Radius = _radius;

_boundsMesh = sphere;

_boundsMesh.Render(sceneRenderState, Material, ref rotationOnly);

}

and
In CollisionBoxShape : CollisionShape add

public override void RenderBounds(SceneRenderState sceneRenderState, ref Matrix rotationOnly)

{

T3DBoxMesh box = new T3DBoxMesh();

box.Center = _center;

box.Extents = _halfSize;

_boundsMesh = box;

_boundsMesh.Render(sceneRenderState, Material, ref rotationOnly);

}

#1
11/13/2008 (6:03 am)
Thanks!
#2
11/17/2008 (5:18 pm)
Awesome! Thanks Sean it works great!