Game Development Community

Triggers acting funny with gravity.

by Nic Biondi · in Torque Game Builder · 03/25/2009 (9:55 am) · 2 replies

I have noticed that when I navigate my character into a large trigger.. it give a continual collision on my character that supercedes gravity. It seems to be tossing collision at it so fast that gravity is powerless against it.

Normal objects work fine inside it.. but not my main character. Been working on it for a few hrs now.. any thoughts?

Thanks Gang!
-nic

#1
03/25/2009 (10:24 am)
Hmmm so many problems with triggers!!!! Circular doesn't seem to work.. anyone get curcular to work correcly? wihout nullifying you gravity?
#2
03/25/2009 (11:01 am)
Ok.. so I figured it out.. I think there's something funky going on still.. but what I did was change the
"%object.setConstantForcePolar(%angleVector, $constantForce, true);"
line to
"%object.setImpulseForcePolar(%angleVector, $constantForce, true);"
I'm not sure why but the curcular trigger was not liking the former method. Works like a charm now.. I can bounce in between moons with my little robot!

function pullCharacter(%this, %object)
{
  switch$ (%object.class)
  {
    case pBall:
     // %object.setGraviticConstantForce(false);
      //get angle and resolve gravity to center of mass
      %srcPos = %object.getPosition();
      %dstPos = %this.getPosition();
      %angleVector=calculateAngle(%srcPos,%dstPos);
      
      rotateErp(%angleVector-180);      
      %object.setImpulseForcePolar(%angleVector, $constantForce, true);
      //%object.setConstantForce(0, $constantForce, true);
  }
}