Trigger Weirdness
by Max · in Torque Game Engine · 05/18/2008 (11:24 am) · 3 replies
Alright, here's my problem.
(I'm using TGE 1.4.2)
I create a trigger; I walk into the trigger.
I fire, but the bullet doesn't come out of the front of the gun, it comes out from behind me.
I've narrowed the problem down to %obj.getMuzzleVector(%slot);
When you are standing in a trigger, that function seems to be off just barely, but when multiplied by the muzzle velocity, the difference is huge.
I've also noticed that you fire forward in 3rd person mode even if you are standing in a trigger.
Could anyone help me out?
(I'm using TGE 1.4.2)
I create a trigger; I walk into the trigger.
I fire, but the bullet doesn't come out of the front of the gun, it comes out from behind me.
I've narrowed the problem down to %obj.getMuzzleVector(%slot);
When you are standing in a trigger, that function seems to be off just barely, but when multiplied by the muzzle velocity, the difference is huge.
I've also noticed that you fire forward in 3rd person mode even if you are standing in a trigger.
Could anyone help me out?
About the author
#2
ShapeBase::getMuzzleVector calls ShapeBase::getCorrectedAim (see shapeImage.cc ~ line 1193). Note where getCorrectedAim makes a castRay() call (~ line 1215). Some lazy fool set the type mask in the ray cast to "0xFFFFFFFF" (all flags on = collide with EVERYTHING including Triggers). I wonder what genius thought *that* was a good idea.
May I suggest replacing "0xFFFFFFFF" with "TerrainObjectType | InteriorObjectType | ShapeBaseObjectType | StaticShapeObjectType | StaticTSObjectType". My guess is that will solve your problem.
06/15/2008 (7:58 am)
I think I found your problem. (Note I'm looking at a 1.4 codebase, but I suspect this hasn't changed in .2)ShapeBase::getMuzzleVector calls ShapeBase::getCorrectedAim (see shapeImage.cc ~ line 1193). Note where getCorrectedAim makes a castRay() call (~ line 1215). Some lazy fool set the type mask in the ray cast to "0xFFFFFFFF" (all flags on = collide with EVERYTHING including Triggers). I wonder what genius thought *that* was a good idea.
May I suggest replacing "0xFFFFFFFF" with "TerrainObjectType | InteriorObjectType | ShapeBaseObjectType | StaticShapeObjectType | StaticTSObjectType". My guess is that will solve your problem.
Torque 3D Owner Max
I still need a solution to this problem. It's been killing me.
Thanks