Frictional Games Forum (read-only)
How to make an entity sway back and forth? - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: How to make an entity sway back and forth? (/thread-19138.html)



How to make an entity sway back and forth? - srobb - 11-08-2012

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.


RE: How to make an entity sway back and forth? - FlawlessHappiness - 11-08-2012

AddPropForce or AddPropImpulse


RE: How to make an entity sway back and forth? - naseem142 - 11-08-2012

(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*


RE: How to make an entity sway back and forth? - FlawlessHappiness - 11-08-2012

Yea sorry... I got lazy


RE: How to make an entity sway back and forth? - Damascus - 11-10-2012

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.