How to apply "swinging" to a rope...??

Official forum for the Chipmunk2D Physics Library.
Post Reply
hm50
Posts: 5
Joined: Wed Mar 16, 2011 9:24 am
Contact:

How to apply "swinging" to a rope...??

Post by hm50 »

Hello All!

I have created a rope class using rects and pivot joints. It works great and looks realistic, I'm struggling with how to make it swing though. I have tried applying impulses at time interval, but you can probably imagine how that turned out lol. I want my player body to be able to jump from rope to rope, but I want to be able to create a swinging effect (for ropes that are farther apart) perhaps by pressing a button apply an impulse while button is pressed, or perhaps a force that gets multiplied based on how long the button is held and then reset forces when button is released. (Im not sure if I should apply it to just the bottom segment or all segments) Anyone have any suggestions?

The other issue I have, is that I want a collision to occur between my player and the rope segments, but I also need the player to stay "attached" to the rope . Suggestions?


Thanks for your time!

Harvey
~~Support Indie Devs~~
[url]http://www.2BPMSoftware.com[/url]
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: How to apply "swinging" to a rope...??

Post by slembcke »

Have you tried forces to only the player?

If you are putting all the rope collision shapes into a group to avoid self collisions, you can still use the layers bitmask or a collision handler to filter out collisions with parts of the rope the player is holding on to.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
hm50
Posts: 5
Joined: Wed Mar 16, 2011 9:24 am
Contact:

Re: How to apply "swinging" to a rope...??

Post by hm50 »

I tried impulses on the player (at timed intervals, that sucked, lol) I'll try the multiplied forces on up swing and reset forces on down swing. (EDIT: Come to think of it, I think the issue might be that I am trying to apply forces at the wrong angle, ie. if the rope has swung to say a 45 deg angle, my forces are still being applied basically to the right side of the screen instead of up and right. My forces would then need to reverse on down swing or at least once past center point and heading left, correct?)

I haven't tried groups, but I did type them and used a collision handler to ignore those types colliding, problem was I also needed to use the same ignore collision methodology to keep the player from jumping back off of the rope. Best luck I have had was to make the player a STATIC_MASS, ignore collisions with rope segments, and just adjust player position in tick based on segment position.

I'll have to read up on how to implement the layer bitmask stuff.

Thanks!
~~Support Indie Devs~~
[url]http://www.2BPMSoftware.com[/url]
Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests