Jump to content


Photo

Object hanging from a rope


  • Please log in to reply
4 replies to this topic

#1 Renier

Renier

    GMC Member

  • GMC Member
  • 40 posts
  • Version:Unknown

Posted 17 June 2012 - 12:02 PM

Hi,

Is it posible to make an object(crate) hanging from a rope swing a little from side to side when the game starts and when a moving object(Rock) hits it on the side it swings more.
After the rock hits the hanging crate and it swings I want it to eventually return to its original swinging speed (a little from side to side). I'm not sure if this is even possible but would appreciate any help.

Thanks!
  • 0

#2 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2087 posts
  • Version:Mac

Posted 17 June 2012 - 12:17 PM

That is definitely possible but it will require maths. However you do it will depend on the effect you want to achieve... do you want it to be realistic where the swinging slows and eventually stops or do you just want it to be constantly swinging back and forth?

That being said... I don't really know enough about physics to tell you what the actual formula would be for determining position. x would probably be determined with some sort of x² and y would probably be the circle forumla (with the radius being the length of the rope), but again, I'm just taking a guess

Edited by dannyjenn, 17 June 2012 - 12:22 PM.

  • 0

#3 Renier

Renier

    GMC Member

  • GMC Member
  • 40 posts
  • Version:Unknown

Posted 17 June 2012 - 12:37 PM

That is definitely possible but it will require maths. However you do it will depend on the effect you want to achieve... do you want it to be realistic where the swinging slows and eventually stops or do you just want it to be constantly swinging back and forth?

That being said... I don't really know enough about physics to tell you what the actual formula would be for determining position. x would probably be determined with some sort of x² and y would probably be the circle forumla (with the radius being the length of the rope), but again, I'm just taking a guess

Okay I see, I would like the realistic one where the swinging slows and eventually stops.
Do you know of some tutorial that maybe has something similar? Even if its not entirely what I want, I'll improvise.
  • 0

#4 C_Pike

C_Pike

    GMC Member

  • GMC Member
  • 565 posts
  • Version:GM8.1

Posted 17 June 2012 - 01:08 PM

tween variable is what you are looking for for the swinging:

From Smart Codes
5:Tween a variable to 0 (like friction)..
Pretty much tweens a variable down to 0. Instead of using 2 if statements, you can just use one line of code.
variable -= sign( variable ) * min( abs( variable ), .5 )

--Edit

You can also browse this

Edited by C_Pike, 17 June 2012 - 01:11 PM.

  • 0

#5 Renier

Renier

    GMC Member

  • GMC Member
  • 40 posts
  • Version:Unknown

Posted 17 June 2012 - 05:24 PM

tween variable is what you are looking for for the swinging:

From Smart Codes
5:Tween a variable to 0 (like friction)..
Pretty much tweens a variable down to 0. Instead of using 2 if statements, you can just use one line of code.

variable -= sign( variable ) * min( abs( variable ), .5 )

--Edit

You can also browse this


Right so I looked at the other forums you gave me the Google link to and the ropes those guys make are really cool but I don't need halve of the realism those guys used, all i want is a normal rope hanging from the roof, it doesn't even have to flexible, a straight line that looks like a rope with an object attached to it on the bottom end, if something collides with the object hanging on the rope it should start swinging and eventually stop swinging after some time. Sorry for the confusion at first I didn't know you could make such realistic ropes in GM
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users