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


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make an entity sway back and forth?
srobb Offline
Junior Member

Posts: 24
Threads: 4
Joined: Sep 2012
Reputation: 0
#1
How to make an entity sway back and forth?

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.
11-08-2012, 02:15 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: How to make an entity sway back and forth?

AddPropForce or AddPropImpulse

Trying is the first step to success.
11-08-2012, 02:31 PM
Find
naseem142 Offline
Member

Posts: 153
Threads: 19
Joined: Oct 2012
Reputation: 0
#3
RE: How to make an entity sway back and forth?

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

I help people when i'm bored :U


Typing Speed: 74 Words per minute
11-08-2012, 05:06 PM
Website Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: How to make an entity sway back and forth?

Yea sorry... I got lazy

Trying is the first step to success.
11-08-2012, 05:19 PM
Find
Damascus Offline
Senior Member

Posts: 646
Threads: 118
Joined: Mar 2012
Reputation: 29
#5
RE: How to make an entity sway back and forth?

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.

11-10-2012, 06:25 AM
Find




Users browsing this thread: 1 Guest(s)