Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Force to trigger function.
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#7
RE: Force to trigger function.

(04-15-2012, 05:29 PM)DRedshot Wrote: You place two areas a certain distance from one another.
Place the first area a few inches away from the wall, and put the second on the wall.

Measure the distance between these areas, and declare it in your script as a constant, ie:
float Distance = 0.25f;

Now when the hammer passes through the first area, start a timer, and when it passes through the second timer, call "GetTimerTimeLeft" and use this value to work out the time taken for the collision.

Now divide the Distance by this number to calculate the speed, and have an if statement to check if the speed is larger than a certain value! Smile


Edit: already answered Tongue
Could I get some more info on this method? I'd like to use this method to break down a door with any of several large rocks laying around. I don't know how to declare constants, start running timers and calculating speed...

This is how I'm planning to start the callbacks (given that there are ten large rocks scattered about the level):

void OnStart
{
for(int i=1;i<=10;i++)

{
AddEntityCollideCallback("rock_debris_01_"+i, "ImpactArea1", "Impact1", false, 1);
}
for(int i=1;i<=10;i++)

{
AddEntityCollideCallback("rock_debris_01_"+i, "ImpactArea2", "Impact2", false, 1);
}
}

04-16-2012, 12:41 AM
Find


Messages In This Thread
Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:11 PM
RE: Force to trigger function. - by Acies - 04-15-2012, 05:19 PM
RE: Force to trigger function. - by Homicide13 - 04-15-2012, 05:21 PM
RE: Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:23 PM
RE: Force to trigger function. - by DRedshot - 04-15-2012, 05:29 PM
RE: Force to trigger function. - by Damascus - 04-16-2012, 12:41 AM
RE: Force to trigger function. - by AnthonyTrix - 04-15-2012, 05:33 PM



Users browsing this thread: 2 Guest(s)