Game Development Community

Adding Additional Collision Meshes to Vehicle Classes

by Demolishun · in Torque Game Engine · 05/26/2006 (3:46 pm) · 0 replies

I am trying to figure out how to have more than one collision mesh for a vehicle. Here is an attempt so far:
Inside of MechaVehicleData::preload :
// Extract collision planes from shape collision detail level
   S32 count = 0;
   //if (collisionDetails[0] != -1) {
   PlaneExtractorPolyList polyList;
   while (collisionDetails[count] != -1) {
      MatrixF imat(1);
      SphereF sphere;
      sphere.center = shape->center;
      sphere.radius = shape->radius;
      
      polyList.mPlaneList = &rigidBody.mPlaneList;
      polyList.setTransform(&imat, Point3F(1,1,1));
      si->buildPolyList(&polyList,collisionDetails[count]);
      
      Con::errorf("ColDetail: %d added",count);
      count++;
   }

Notice that I am letting it add additional collision meshes. I do get indication that it is loading the 3 collision meshes I have defined in my vehicle. Other than this I don't understand how to get more meshes into the equation for collision. I looked through the rest of the WheeledVehicle (what my vechicle is based on) and Vehicle code and cannot find anything that indicates I need to change more. Also, the collision meshes show up when you are running the editor in game.

About the author

I love programming, I love programming things that go click, whirr, boom. For organized T3D Links visit: http://demolishun.com/?page_id=67