Triggers turning off gravity
by Bryce Fosheim · in Torque Game Builder · 02/13/2012 (9:36 pm) · 4 replies
I'm using the editor based gravity system. Similar if not exact to the ninja platformer tutorial.
When I include a trigger into the level and jump through it, it seemingly turns off gravity and the character maintains the vertical velocity it had when it entered the trigger. It's just a stock trigger too. No matter what the collision settings or call-back settings are on the trigger it maintains the players vertical velocity.
I may have to actually develop my jump function into something that is mine and not taken from a tutorial. All it does is set the vertical velocity and let gravity bring it back down to earth. Triggers for some odd reason disable the gravity's affect. I haven't found a solution yet though.
When I include a trigger into the level and jump through it, it seemingly turns off gravity and the character maintains the vertical velocity it had when it entered the trigger. It's just a stock trigger too. No matter what the collision settings or call-back settings are on the trigger it maintains the players vertical velocity.
I may have to actually develop my jump function into something that is mine and not taken from a tutorial. All it does is set the vertical velocity and let gravity bring it back down to earth. Triggers for some odd reason disable the gravity's affect. I haven't found a solution yet though.
function Player.playerJump(%this, %level)
{
if($myPlayer.getLinearVelocityY() <= 1 && $myPlayer.getLinearVelocityY() >= 0)
{
$myPlayer.setLinearVelocityY(-225);
}
}About the author
Recent Threads
#2
05/30/2012 (11:25 am)
Try unchecking/deactivating all of the collision boxes in the trigger's editor especially the 'send Collision' so that the ninja object doesn't think the trigger is a floor.
#3
It doesn't really matter anymore, I suppose; I've got a workaround that essentially ended up creating my own type of trigger. I've got a SceneObject with no collisions or physics, and once each frame I PickPoint on the player to see if he's inside the SceneObject.
05/30/2012 (12:21 pm)
All the collision and physics boxes are unchecked, and I'd deselected all the collision layers just for good measure. I'm really wondering if there isn't something buggy about the way Trigger objects handle physics.It doesn't really matter anymore, I suppose; I've got a workaround that essentially ended up creating my own type of trigger. I've got a SceneObject with no collisions or physics, and once each frame I PickPoint on the player to see if he's inside the SceneObject.
#4
The only other thing I can really think of is have the ninja and trigger on different collision layers.
05/30/2012 (12:50 pm)
Hmm... that is a little strange. Oh well, good luck.The only other thing I can really think of is have the ninja and trigger on different collision layers.
Torque Owner Nicholas T Pawlowski
Default Studio Name
Also potentially related; I started with the ninja platformer tutorial, though by now very little of the original code is in use.
Caffeinated, your original post was back in February. Did you ever find a fix?