creating a smooth rope with an android physics engine
I want to practice programming with (popular) android physics engines (AndEngine and libgdx).
It is not very difficult to create a small world with physics objects but now I want to create a rope and connect it to objects in the world.
There are several ways to do it, for e开发者_如何学运维xample:
http://www.emanueleferonato.com/2009/10/05/basic-box2d-rope/But I want to see a smooth rope like in "Cut The Rope" game on Android and IOS.
Are there any ideas how to do this? I can't find answer yet but I think it would be to create a number of smaller objects tied together but I think this would be bad performance-wise?
I believe your instinct to create shorter segments with joints connecting them is correct and yes, the number of bodies you end up creating for a length of rope will have an effect on the performance.
To know whether it will work for your particular situation, I would suggest creating a rope with variable length segments and make a decision based off benchmarking the performance as to how smooth you can make the rope by increasing the number of segments.
On ios we based our rope on this example, http://www.cocos2d-iphone.org/archives/1112 , we are now trying to port it to android, but our version of the box2d does not support the rope joint yet.
精彩评论