|
Feedback
Posted: May 14, 2008
Category: nCloth
For grabbing cloth the key technique to use is to animate the enable on the constraint. When a constraint becomes enabled it reforms its connections based on the relative distances at the time it is enabled.
In this tutorial we will grab a simple plane of cloth with a cube. In a real world scene one could substitute an animated hand for the cube and the simulation would still work the same. A nice property is that the deformation of the hand would also be taken into account. One could instead try to grab by closing fingers of a hand around the cloth and using friction, but that would be much more difficult to simulate than this method. 1. Create a simple cube and plane. Make the plane nCloth and on the nucleus node turn on usePlane on the nucleus node so that the cloth just sits on the ground. The cube will represent our grabby hand. Keyframe it moving around as you wish the hand to move.
2. Select 2 or more vertices on the cube where you wish to attach along with the cloth plane and create a point to surface constraint. (You can enable collisions on the cubes nRigid node if you additionally want the cloth to collide with the cube) Note that you need at least 3 constraining vertices if you want to be able to twist the cloth in any direction by rotating the cube. If you had used vertices on fingers then the cloth would also respond to the relative motions of the fingers.
3. Key the enable attribute of the constraint ON when you wish the "hand" (cube) to grab the cloth and OFF when you wish to release it. This can be repeated multiple times and the attachments will always be formed at the frame where enable is keyed ON.
| |||||