Rope Colliding with a Rectangle
Posted
by
Colton
on Game Development
See other posts from Game Development
or by Colton
Published on 2013-11-10T04:40:44Z
Indexed on
2013/11/10
10:18 UTC
Read the original article
Hit count: 289
I have my rope, and I have my rectangles.
The rope is similar to the implementation found here: http://nehe.gamedev.net/tutorial/rope_physics/17006/
Now, I want to make the rope properly collide with the rectangle such that the rope will not pass through a rectangle, and wrap around the rectangle and all that good stuff.
Currently, I have it set so no rope node can pass through a rect (successfully), however, this means a rope segment can still pass through a block. Ex:
So the question is, what can I do to fix this?
What I have tried:
I create a rectangle between two nodes of a rope, calculate rotation between the nodes, and get myself a transformed rectangle.
I can successfully detect a collision between rope segments and a (non-transformed) rectangle.
Create a new node or pivot point around the corner of the block, and rearrange nodes to point to the corner node. Trouble is determining what corner the rope segment is passing through. And then the current rope setup goes wonky (based on verlet integration, so a sudden change in position causes the rope to wiggle like a seismograph during a magnitude 8 earth quake.) Among other issues that might be solvable, but its turning into a case by case thing, which doesn't seem right.
I think the best answer here would just be a link to a tutorial (I simply can't find any, most lead to box2D or farseer, but I want to at least learn how it works before I hide behind an engine).
© Game Development or respective owner