Game Maker Community YoYo Games

Welcome Guest ( Log In | Register )

> Tutorials Rules

This forum is for clear and concise tutorials and well documented examples. Tutorials and examples posted here must follow the format in the pinned Rules and Guidelines.

All new topics must be approved by a moderator before they appear. Don't post twice!

 
Reply to this topicStart new topic
Realistic Rope Physics(example), works in LITE with modification
ditdingiscool
post Feb 15 2009, 04:52 PM
Post #1


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



  • Title: advanced rope physics
  • Description: realistic(ish) ropes
  • GM Version: gm7
  • Registered: no, see aditional information
  • File Type: gmk
  • File Size: 20kb
  • File Link: http://www.box.net/shared/3l42rtc6bg

Additional Info
for lite users:this wont work unles you replace all the ds-lists with arrays...

EDIT: READ THIS>>> uploaded my old version... new version at the link above, waaay better than the old one smile.gif sorry if this caused any inconvenience to you guys, all my replies are made with the new version in mind, so sorry for any incorrect information...

EDIT2:you can read how this works on my blog(click the banner in mys sig)

This post has been edited by ditdingiscool: Mar 11 2009, 02:35 PM
Go to the top of the page
 
+Quote Post
Dark Mario
post Feb 15 2009, 08:07 PM
Post #2


GMC Member
Group Icon

Group: GMC Member
Posts: 127
Joined: 10-April 08
Member No.: 104167



How does the plugs work?
Go to the top of the page
 
+Quote Post
toopz
post Feb 16 2009, 04:42 AM
Post #3


Spriter
Group Icon

Group: GMC Member
Posts: 794
Joined: 13-July 04
From: Arkansas, USA
Member No.: 11581



This is just plain cool man. I think I'm gonna use this. Only few questions I have is if there's a way to adjust the resolution of the ropes. It wasn't very noticeable, but I did nonetheless noticed some clear segments in the ropes when I moved them quickly. Though I think it's at a good balance of detail vs speed, it would still be a good thing to know I suppose.

Good work
Go to the top of the page
 
+Quote Post
Newly Discovered
post Feb 16 2009, 05:49 AM
Post #4


Harmonious Genius
Group Icon

Group: GMC Member
Posts: 2144
Joined: 14-October 05
From: ....Wonderland.... Pwned? Of Course
Member No.: 36998



Agreed. this is pretty awesome. I love wire engines. you could bring this pretty far.
maybe come up with more devices, and some explanation on what's in here.

anyway, I love it.
Go to the top of the page
 
+Quote Post
gloinus
post Feb 16 2009, 03:25 PM
Post #5


GMC Member
Group Icon

Group: GMC Member
Posts: 39
Joined: 8-December 07
Member No.: 94827



Nope, doesn't work in lite.
Go to the top of the page
 
+Quote Post
ditdingiscool
post Feb 16 2009, 04:30 PM
Post #6


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



@gloinus in the screens2 object in the step event, remove the "scr2.image_angle=point_direction(obj1.x,obj1.
y,obj2.x,obj2.y)" line, this should be the only pro thing in there...

@toopz there is a way to change resolution, when you look at the 'create_rope' script, there is a short explanation of the function:
create_rope(x1,y1,x2,y2,nodes,maxlen)
where the 'nodes' argument changes the amount off segments, so when an instance creates a rope it calls that function, for example the screens object calls it two times in the create event, so you can change the resolution there...

@Dark Mario you mean the points where the rope is fixed to something?, a rope consists of one 'rope' object, and multiple 'dot' objects, when you create a rope, the create_rope() functions returns the id off the rope object, which contains a ds-list with all dot objects in it, you use this to find the correct dot, and then set the 'fixed' variable to true for that dot, this prevents it from falling, and you can just set the x/y coordinates off that dot,

@gloinus, @toopz and Dark mario, these comments are for the wrong version, please re-download for the new version, sorry for that...

if someone still has questions/suggestions, please comment...

This post has been edited by ditdingiscool: Feb 17 2009, 05:26 PM
Go to the top of the page
 
+Quote Post
Dark Mario
post Feb 18 2009, 10:00 PM
Post #7


GMC Member
Group Icon

Group: GMC Member
Posts: 127
Joined: 10-April 08
Member No.: 104167



@ ditdingiscool

What I meant is how does the demo (sending information) works.
Example: If I connect 3 then + then 5 the graph.
Thats what i meant.

Go to the top of the page
 
+Quote Post
ditdingiscool
post Feb 19 2009, 10:08 AM
Post #8


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



QUOTE (Dark Mario @ Feb 18 2009, 11:00 PM) *
@ ditdingiscool

What I meant is how does the demo (sending information) works.
Example: If I connect 3 then + then 5 the graph.
Thats what i meant.


yeah i realized that i posted the wrong version, the new one has smaller example but the same type off deal could be made with the new one,
and now for the answer:
the plug that is created keeps track off the currect value, and makes sure the other plug also has this value, then the other objects set/get the values for the plugs, it's realy simple actualy. you just have to make sure that when the value off the first plug changes the second plug should change with it...
Go to the top of the page
 
+Quote Post
chocoblock
post Feb 20 2009, 11:16 PM
Post #9


GMC Member
Group Icon

Group: GMC Member
Posts: 36
Joined: 28-August 08
From: England
Member No.: 113860



wow nice engine i wish i could make something like that.
Go to the top of the page
 
+Quote Post
ditdingiscool
post Feb 21 2009, 10:28 AM
Post #10


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



QUOTE (chocoblock @ Feb 21 2009, 12:16 AM) *
wow nice engine i wish i could make something like that.

it's not that hard to make, and this can actualy do more than only ropes, if you can get the dot object to collision with a wall object you could make softbody physics with this...
i can't even make a working platform engine, so this is easier to make than al those mario/sonic/whatever clones

This post has been edited by ditdingiscool: Feb 21 2009, 10:31 AM
Go to the top of the page
 
+Quote Post
2d_games
post Feb 21 2009, 07:07 PM
Post #11


GMC Member
Group Icon

Group: GMC Member
Posts: 1375
Joined: 26-October 07
Member No.: 91595



QUOTE (ditdingiscool @ Feb 21 2009, 05:28 AM) *
QUOTE (chocoblock @ Feb 21 2009, 12:16 AM) *
wow nice engine i wish i could make something like that.

it's not that hard to make, and this can actualy do more than only ropes, if you can get the dot object to collision with a wall object you could make softbody physics with this...
i can't even make a working platform engine, so this is easier to make than al those mario/sonic/whatever clones


I can't make physics like this but I can platform engines with ease.

I'm not sure this could work in lite though. It uses the ds_list functions...
Go to the top of the page
 
+Quote Post
ditdingiscool
post Feb 22 2009, 09:52 AM
Post #12


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



QUOTE (gamemakernooby @ Feb 21 2009, 08:07 PM) *
QUOTE (ditdingiscool @ Feb 21 2009, 05:28 AM) *
QUOTE (chocoblock @ Feb 21 2009, 12:16 AM) *
wow nice engine i wish i could make something like that.

it's not that hard to make, and this can actualy do more than only ropes, if you can get the dot object to collision with a wall object you could make softbody physics with this...
i can't even make a working platform engine, so this is easier to make than al those mario/sonic/whatever clones


I can't make physics like this but I can platform engines with ease.

I'm not sure this could work in lite though. It uses the ds_list functions...

those work in lite right?
*searches manual*
shoot, you're right, man thats stupid, never knew smile.gif
but you can use this in lite, but then you would need to hard-code the ropes/connections,
or you could re-code it with arrays tongue.gif
Go to the top of the page
 
+Quote Post
benja
post Jul 7 2009, 01:11 PM
Post #13


GMC Member
Group Icon

Group: GMC Member
Posts: 111
Joined: 19-February 08
Member No.: 100546



Please release a lite version.
Go to the top of the page
 
+Quote Post
ditdingiscool
post Jul 8 2009, 09:41 AM
Post #14


GMC Member
Group Icon

Group: GMC Member
Posts: 337
Joined: 6-October 07
Member No.: 90046



QUOTE (benja @ Jul 7 2009, 03:11 PM) *
Please release a lite version.

that would be hard, this uses ds-lists, i can give you a piece off core code with which you can achieve the same effects:
CODE
//join(from,to,length)
f=argument0
t=argument1
l=argument2
dis=point_distance(f.x,f.y,t.x,t.y);
dir=point_direction(f.x,f.y,t.x,t.y);
dif=dis-l
if(f.fixed=true or t.fixed=true)
dif=dif*2

if!(f.fixed)
{
f.x+=lengthdir_x(dif/2,dir);
f.y+=lengthdir_y(dif/2,dir);
f.hspeed+=lengthdir_x(dif/2,dir);
f.vspeed+=lengthdir_y(dif/2,dir);
}
if!(t.fixed)
{
t.x+=lengthdir_x(dif/2,dir+180);
t.y+=lengthdir_y(dif/2,dir+180);
t.hspeed+=lengthdir_x(dif/2,dir+180);
t.vspeed+=lengthdir_y(dif/2,dir+180);
}

place that in a script called 'join'with this you can make sure two objects stay at the same distance, note that both the from and the to instance need to have the fixed variable set, just do something like this:
CODE
//dummy object create event
gravity=1
fixed=false

CODE
//control object create event
n1=instance_create(x,y,dummy)
n2=instance_create(x+32,y,dummy)
n1.fixed=true

CODE
//control object step event
join(n1,n2,32)

CODE
//draw event control object
draw_line(n1.x,n1.y,n2.x,n2.y)


that will create a line thats anchored at one end and acts like a pendulum at the other end. the real engine works like that with only one difference:it loops through a set off ds-lists so you don't have to call the join function for each rope section, but since this is not available in light you need to do it manualy or use arrays...
Go to the top of the page
 
+Quote Post
benja
post Jul 9 2009, 12:32 PM
Post #15


GMC Member
Group Icon

Group: GMC Member
Posts: 111
Joined: 19-February 08
Member No.: 100546



Cheers nigga, I'll tell you how it goes smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 9th February 2010 - 01:47 PM