Frictional Games Forum (read-only)

Full Version: Throwing Daniel Around
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So what I'd like is that when the player approaches an open door, he walks into a script area & activates it, then is pushed forward through the door, and the door slams closed behind him. Smile

I'm fine with script areas, I just need to know how to push Daniel through the door, (possibly also having him fall over too?) and then how to slam the door shut. Any help?
Code:
void AddPlayerBodyForce(float afX, float afY, float afZ, bool abUseLocalCoords);
Pushes the player into a certain direction. Note that you need values above ~2000 to see any effects.

afX - amount along the X-axis
afY - amount along the Y-axis
afZ - amount along the Z-axis
abUseLocalCoords - If true, axes are based on where the player is facing, not the world.
AddPlayerBodyForce, okay, but do I have to play around with X Y Z values or can you give me an example?
Any ideas on pushing the door shut?
play around with the X Y Z values, you should only need either X or Z. as for the door, put an area at the other side of the door, so when he hits it, the door slams, using

SetSwingDoorClosed("Door" , true , true);

or

AddPropForce("Door" , float afX, float afY, float afZ, bool abUseLocalCoords);

to close it Smile
They're World coordinates.
Alright I'll do that, but for the X Y Z values, are they special or can I just write plain old '6' or'12'?
I'd suggest writing 5000 or bigger as Daniel is stronger and heavier than doors Smile
So I have it set to
AddPlayerBodyForce(9000, 0, 0, true);
and when I walk into the script area nothing happens. Do I have to disable the player controls for it to work?
Not true, set is false to use global coordinates.
I changed that, and I think there was a little push but I couldn't tell. I'm going to try and disable player controls..
Pages: 1 2