[Flash 10+]

Mars 2014

Rendering soft bodies

Based on this demo cool soft bodies demo : https://napephys.com/samples.html

[swfobj src=”https://yopsolo.fr/ressources/SoftBodies.swf” alt=”Animation Flash” width=”640″ height=”480″ class=”flashObject” AllowScriptAccess=”always” allowfullscreen=”false” bgcolor=”#ffffff” required_player_version=”10″]

Here is how I build it ( If you know a better way to do it please let me know :) )

If you press space bar, you can see the nape skeleton.

By taking the top left point of each compound, Nape can provide the ‘external Hull’ (red dots) of the soft body.

but we also need to compute the yellow ones in order to draw the texture.

Fortunatly thoses dot are easy to find, as you can see the dot marked C’ is calculated as the symetric image of C on the AB axis

Now we have all the points to map the texture on the shape using the native drawTriangles method.