In this tutorial I (xtron) will explain how to use Prop/Body force and impulses
How to get the coordinates:
Create an item were the player/prop stands when it/he's geting pushed then you press ctrl+d ( duplciate it ) and drag it to the place where
he's going to get pushed to.
imageshack.us/f/706/positiong.png/
Lets say that blue dot is the player/prop and he's going to get pushed to the chair that got the X position -3.5, you replace “float afX”
with “-3.5f” and you're done.
And there you go, you just found out how to get the coordinates.
I will use BodyForce for an example only, you can use PropForce exactly the same as BodyForce.
AddBodyForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
This function will push the player in a certain direction and by using the method I showed you, you will get the coordinates.
We will use the same coordinates shown on the picture.
imageshack.us/f/706/positiong.png/
Lets say the player stands on the blue dot and is geting to the chair. you will need to modify the function like this:
AddBodyForce("Player", -3.5f, 0.0f, 0.0f, "world");
the player will now be pushed to the X coordinate -3.5. He will NOT move in the air unless you change the Y coordinate a bit.
If you move the chair upp a bit you will see that the Y coordinate will change. When you're done you need to change the code again
like this:
Lets say you moved the chair so Y is 2.0
AddBodyForce("Player", -3.5f, 2.0f, 0.0f, "world");
Now will the player fly abit aswell.
THIS CAN BE USED WITH
AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);
Aswell!
READ!: IF YOU'RE GONNA USE AN IMPULSE I SUGGEST YOU USE HIGH NUMBERS LIKE “500.0f” OR “5000.0f”
Created by xtron