Game Development Community

Shooting backwards while in trigger

by Shaderman · in Torque Game Engine Advanced · 10/30/2007 (6:59 am) · 2 replies

Hi.

I'm using TGEA 1.0.3 with bullet hole decals. When I shoot while the player is in a trigger, the shots are going backwards and the decals are drawn somewhere behind the player.

I attempted to fix it like this without success:

void Player::getMuzzleTransform(U32 imageSlot,MatrixF* mat)
{
   MatrixF nmat;
   Parent::getRetractionTransform(imageSlot,&nmat);
   MatrixF smat;
   Parent::getImageTransform(imageSlot,&smat);

   disableCollision();

   // See if we are pushed into a wall...
   if (getDamageState() == Enabled) {
      Point3F start, end;
      smat.getColumn(3, &start);
      nmat.getColumn(3, &end);

      RayInfo rinfo;
      if (getContainer()->castRay(start, end, 0xFFFFFFFF [b]& ~TriggerObjectType[/b], &rinfo)) {
         Point3F finalPoint;
         finalPoint.interpolate(start, end, rinfo.t);
         nmat.setColumn(3, finalPoint);
      }
      else
         Parent::getMuzzleTransform(imageSlot,&nmat);

Any ideas?

Stefan

#1
10/30/2007 (10:06 am)
Using "correctMuzzleVector = true;" in your weapon scripting causes this issue.

I have not looked much farther into this right now.
#2
11/07/2007 (10:57 pm)
Sorry I'm a bit confused these days (ok I'm always confused) :x I mixed up two different issues I had/have here. Trigger::castRay() seems to cause it. Commenting it out solves that backwards shooting issue for the moment. Not sure what it breaks though yet.

Sorry for the confusion, hope it helps.