Game Development Community

Collisions and Convexes

by Ryan Mounts · in Torque 3D Professional · 09/09/2009 (2:20 pm) · 2 replies

I'm wondering if someone can shed some light on the collision system for me. I've extended the MeshRoad tool to create some extra procedural geometry in addition to the basic road. I can render the geometry just fine, but I can't seem to get the collisions to work. In MeshRoad::buildConvex, I am creating a MeshRoadConvex for each of my new triangles in the same fashion as the original code (same winding order, etc.). In MeshRoad::buildSegmentPolyList, I am adding my new verts and planes in the same fashion as the original code. When Player Collision visibility is turned on ingame, I can see my MeshRoadConvexes displayed where they should be when I'm near the MeshRoad. While debugging, I can see that my new MeshRoadConvexes are in the player's WorkingList of nearby convexes as I approach the MeshRoad ingame. But in the end, the player only collides with the original MeshRoad geometry and totally ignores my new geometry. So apparently I'm missing soming here, and maybe someone can quickly spot where I'm going wrong. Thanks in advance!

#1
09/10/2009 (3:03 pm)
Ok, I have partially figured out the problem. I was creating my new geometry in MeshRoad::_generateVerts(), which only executes clientside, so the server didn't know the new geometry existed and hence didn't create convex collision hulls for it. Got that part fixed. Now my player can collide with the new procedural geometry, but other things like projectiles and the camera still act like nothing's there. So I need to fix that issue. Any thoughts are always appreciated.
#2
09/10/2009 (3:55 pm)
Got it all working now... projectiles and the camera use raycasts instead of convexes to do collision tests (duh), so I just needed to update MeshRoad::castRay().