Jump to content

Recommended Posts

Trigger based Jump Pad (like Quake 3)

This Trigger will launch the AI or Player wherever the Trigger is "facing".

This assumes you are familiar with creating and using Triggers within Torque.


UPDATE: The force that the Jump Pad pushes the AI or Player can now be set as a Dynamic Value within the Trigger itself. This will allow you to have multiple Jump Pads with various amounts of force within your mission.


 

datablock TriggerData(JumpPadTrigger)
{
   tickPeriodMS = 1000;
};
 
function JumpPadTrigger::onEnterTrigger(%this, %trigger, %obj)
{
   //set the force the Jump Pad pushes the player at as a Dynamic Value
   %jumppadforce = %trigger.getFieldValue(JumpPadForceRef);
 
   //get the direction the trigger is "facing" (theta)
   %aim = %trigger.getForwardVector();
 
   //take the getForwardVector and add some force
   %impulseVec = vectorScale(%aim, %jumppadforce);
 
   //take the above mix and add some additional direction if needed
   %impulseVec = vectorAdd(%impulseVec, "0 0 0");
 
   //apply this to any AI/Player that enters the trigger
   %obj.applyImpulse("0 0 0", %impulseVec);
 
   //TODO: add your audio here
}
 
function JumpPadTrigger::onLeaveTrigger(%this, %trigger, %obj)
{
   ECHO("WHEE!");
}

 

After creating your JumpPadTrigger within the editor create a Dynamic Field called JumpPadForceRef and set its value to the amount of force you want to push the AI or Player at.

Edited by Mack
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...