Frictional Games Forum (read-only)

Full Version: How to make an entity sway back and forth?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi.
I want to make a lamp (hanging_lantern_ceiling_1 in my level editor) sway back and forth like someone's just hit it.
How do I do this?
Thanks in advance.
AddPropForce or AddPropImpulse
(11-08-2012, 02:31 PM)beecake Wrote: [ -> ]AddPropForce or AddPropImpulse
Be more detailed with newbies ( if he is ) ,


AddPropForce(string& asName, float afX, float afY, float afZ, string& asCoordSystem);

AddPropImpulse(string& asName, float afX, float afY, float afZ, string& asCoordSystem);

Pushes objects. Note that rather high values are needed when applying forces.
asName - the object to push
afX - direction along the X-axis
afY - direction along the Y-axis
afZ - direction along the Z-axis
asCoordSystem - determines which coordinate system is used, usually “world”


*Taken from the wiki*
Yea sorry... I got lazy
I do this in my game:

void SwingLantern2(string &in asTimer)
{
AddPropForce("hanging_lantern_wall_10", 200, 0, 200, "world");
AddTimer(asTimer, 1.5f , "SwingLantern2");
}

Exerts a repeated force on a hanging object. It's kind of obvious by the way it jerks at the exact time the force is applied, but it's the most subtle numbers I could find.