Game Development Community

TSShapeInstance::castRay....mesh object transform is null?

by Juan Aramburu · in Torque Game Engine Advanced · 07/26/2006 (12:48 pm) · 0 replies

I keep getting a debug break (or crash in release mode) inside of TSShapeInstance::castRay()

bool TSShapeInstance::castRay(const Point3F & a, const Point3F & b, RayInfo * rayInfo, S32 dl)
{
   // if dl==-1, nothing to do
   if (dl==-1)
      return false;

   AssertFatal(dl>=0 && dl<mShape->details.size(),"TSShapeInstance::buildPolyList");

   // get subshape and object detail
   const TSDetail * detail = &mShape->details[dl];
   S32 ss = detail->subShapeNum;
   S32 od = detail->objectDetailNum;

   // set up static data
   setStatics(dl);

   S32 start = mShape->subShapeFirstObject[ss];
   S32 end   = mShape->subShapeNumObjects[ss] + start;
   RayInfo saveRay;
   saveRay.t = 1.0f;
   const MatrixF * saveMat = NULL;
   bool found = false;
   if (start<end)
   {
      Point3F ta, tb;

      // set up for first object's node
      MatrixF mat;
      [b]MatrixF * previousMat = mMeshObjects[start].getTransform();[/b] //<----returns NULL
      mat = *previousMat; //<------obviously breaks the engine
      mat.inverse();
      mat.mulP(a,&ta);
      mat.mulP(b,&tb);

What would cause a TSShapeInstance mesh object ot have a null transform?