I have created an oval (2D), deformable by dragging, as elastic as rubber or jelly, able to collide with other rigid bodies and bounce. Now I can change its shape in some way by dragging the oval.
The problem I am facing now is that the oval doesn't deform in the way I want. The desired effect is that there is one point on the oval fixed when the user taps the oval and the user can then drag the oval resulting in it becoming longer and thinner (the total size of the ball does not change). The oval is supposed to stay in its initial position when this occurs.
Currently, I haven’t found a way for the oval to be fixed in a certain position when the stretching of its shape occurs.
Is there any way to achieve such an effect with LiquidFun? If so, do you have any advice on how to go about it? If not, I would be really grateful for any other suggestions.
Yes. It's a solid elastic particle group. See:
http://google.github.io/liquidfun/
and choose Elastic Particles to see it in action. Sample code is here:
https://github.com/google/liquidfun/blob/master/liquidfun/Box2D/Testbed/Tests/ElasticParticles.h
Creating the particle group looks like this:
You'd have to make an oval shape in Box2D instead of a circle. AFAIK, Box2D doesn't support ellipse as a core shape, so you'd need to probably approximate on with a b2PolygonShape with many edges. The total number of edges probably won't matter much, since it will be "rasterized" into particles anyhow.