Ball and chain
Hi all,
I'm not using a physics engine because I like 60fps and don't need many real world physics.
I would like to implement a simple chain effect.
i.e. pull 1 end and the rest follows appropriately.
I'm working in 2d so the effect is really just for visual 'niceness' rather than a requirement.
I have googled but can't seem to fine anything relevant to what I need - was hoping I would find some as3 code example; but of course they tend to use 3rd party physics engines.
Old school 2d tile games sometimes had these effects (zelda, castelvania etc.) so just wondering if anyone has any pointers or suggestions.
Cheers
I'm not using a physics engine because I like 60fps and don't need many real world physics.
I would like to implement a simple chain effect.
i.e. pull 1 end and the rest follows appropriately.
I'm working in 2d so the effect is really just for visual 'niceness' rather than a requirement.
I have googled but can't seem to fine anything relevant to what I need - was hoping I would find some as3 code example; but of course they tend to use 3rd party physics engines.
Old school 2d tile games sometimes had these effects (zelda, castelvania etc.) so just wondering if anyone has any pointers or suggestions.
Cheers
A physics engine only takes a lot of CPU if you give it a lot of tasks to manage. Sounds like Box2D would solve your problem perfectly to me. I can't imagine it would be doing much more than any homebrew solution might entail.
(I can't think where a link might be for your rope problem as I solved it myself once a while back. I'm no math whizz either - it's not hard if you sit and think about it, especially in 2D. Read up on moments and torque)
(I can't think where a link might be for your rope problem as I solved it myself once a while back. I'm no math whizz either - it's not hard if you sit and think about it, especially in 2D. Read up on moments and torque)
Thanks Applewood.
The reason I don't use a physics engine is it wouldn't fir in with everything else I have :-)))
For example it's not going to integrate with my tile collision map and yet I would like my chain(rope) to register collisions with the scenery. I'd have to implement everything in the physics world to make all objects correct; and I don't want to do that! :-))))
Will check out moments and torque.
Cheers
The reason I don't use a physics engine is it wouldn't fir in with everything else I have :-)))
For example it's not going to integrate with my tile collision map and yet I would like my chain(rope) to register collisions with the scenery. I'd have to implement everything in the physics world to make all objects correct; and I don't want to do that! :-))))
Will check out moments and torque.
Cheers
Use jakobsen style vertlet physics: http://www.gamasutra.com/resource_guide/...n_01.shtml
I recently did a quick example implementation for Chipmunk/Cocos2D here including drawing thick lines using triangle strips: https://gist.github.com/792276
It would be very easy to extend to be textured.
I recently did a quick example implementation for Chipmunk/Cocos2D here including drawing thick lines using triangle strips: https://gist.github.com/792276
It would be very easy to extend to be textured.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Hey Skorche,
Thanks for the info. I'm an old style 'C' guy; but I'll take a bash at understanding the obj-c stuff and chipmunk.
Hmmm........
Cheers
Thanks for the info. I'm an old style 'C' guy; but I'll take a bash at understanding the obj-c stuff and chipmunk.
Hmmm........
Cheers
Chipmunk is written in C, and the vertlet code I pasted does all the heavy work in C functions. Other than that it more or less just has an init, draw and step methods to fit into Cocos2D. I think you should find it quite understandable if you read the Gamasutra link. 
The Chipmunk parts aren't particulary important either. I just used it for the 2D vector functions and to get the rope endpoints from the rigid body objects that they connect to in the physics world. You can rip all of that out and just set the endpoints of the rope using whatever code you want.

The Chipmunk parts aren't particulary important either. I just used it for the 2D vector functions and to get the rope endpoints from the rigid body objects that they connect to in the physics world. You can rip all of that out and just set the endpoints of the rope using whatever code you want.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Ok!, though can't see any definitions for all the cpvlerp,cpvsub etc. etc. etc.
Cheers
Cheers
Those are all part of the Chipmunk library. If you just want to look at the cpVect header: http://code.google.com/p/chipmunk-physic...k/cpVect.h
You can grab the full lib from my signature.
You can grab the full lib from my signature.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Thanks Skorche,
I will take a look and see if I can work it out! ;-))
Cheers
I will take a look and see if I can work it out! ;-))
Cheers
Skorche, thanks for posting example implementation. it's easier to understand how it works, when there is a code.
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Ball Bouncing in a circle | strikerjax | 6 | 4,079 |
Jul 6, 2009 02:39 PM Last Post: strikerjax |
|

