|
|
Worm Animation Index
First we need to create a new smls file.
Click on the new smls file button
and save the new smls file as wormAnimation.smls
Open the scene tree window
Create a structure of 8 parts and name them as shown
Like this each Part except for seg0 will have a parent Part it belongs
to. We will later see how each parent Part will have an affect on their descendants when they are animated.
Drag a new GroupBuild to the Seamless node
Select the CylinderBuild ![]() In the 3d window:
![]() Transferring Ownership to the Rest of the Parts At this stage Part seg0 contains all the vertices. To share the vertices out to the other 7 parts, we will use 7 TransferVertex nodes. Drag a new GroupBuild as a sibling below the last GroupBuild ![]() Drag 7 new TransferVertex nodes to the new GroupBuild and reference the source and destination parts as shown:
Node: Set the first TransferVertex node's fromVertex to 16 so that we are left with 2 rings of vertices in Part seg0. Leave the numOf field to the default -1 value. -1 is interpreted as a very large number. This will cause the first TransferVertex node to transfer the ownership of all vertices after the first 16 vertices in seg0 to seg1, leaving seg0 to own the first 2 rings of vertices in the cylinder. Set the rest of the TransferVertex node's fromVertex field to 8 so that we have one ring of vertices left for the remaining Parts We can verify if we have the correct vertices owned by a part. If we
click on a vertex in the 3d window the 3d window's title bar will
display
the part the vertex is owned by. (the part that has ownership over the
vertex)
Collapse the GroupBuild node that contains the TransferVertex nodes. At this stage we have all the part's owning a portion of the vertices in the cylinder but the parts are not yet ready to be animated because they are all centred at the base of the cylinder, that is if we select any part we will see the the yellow dot at the base of the cylinder. Because each part rotates around it's yellow dot when animated this will not do. To change the center of each part we will use the CenterJoint node. The CenterJoint node centers the part it USEes to a location calculated by averaging all the locations of the vertices specified.
Drag a new GroupBuild as a sibling of the last GroupBuild.
Set the first CenterJoint's baseVertex to 8 and it's numOf to 8 so that seg0 is centered to it's top ring of vertices. baseVertex specifies the vertex (by it's index) the averaging will begin from and numOf specifies how many vertices there after to average. (The coordIndex displayed in the top left of the 3d window shows the selected vertex's index) Set the rest of the CenterJoints each with a numOf field set to 8 and each baseVertex left set to 0 Now if we select seg0 we will see the yellow
dot
in the center of it's top ring of vertices and all the rest of the
parts
when selected will show the yellow dot in the center of their ring of
vertices.
This means our cylinder is now ready to be animated like a worm.
At this stage all the parts are ready for animation but I think it
would
be sad to write the rest of the tutorial before our worm is colored
unless
we want it white.
Expand The top GroupBuild node containing the CylinderBuild and drag a new ColorSweep
as a sibling below the CylinderBuild.
Select the ColorSweep.
Note The reason for having location =0
-.001 0 and the last distance element = .052 instead of .05 is so that all the vertices are ensured of being overlapped slightly.
We can easily animate all the segments using a standard VRML OrientationInterpolator which is explained in my minimalist tutorial but here I will show how anyone can easily use a Seamless3d RotAccelerator node to create sophisticated looking movement. Add a time sensor node to the scene node paste/children/new/TimeSensor
In the TimeSensor node we should now see the ROUTE we added:
For the RotAcclerator:
We should now see the worm animate.
The following graph shows the envelope for our
RotAccelerator's angle:
Returning the Rotations Back to Where They Start We can add more envelopes by incrementing the count button.
We will now make the worm come back to where it starts smoothly:
Now we see a worm bending back and forth smoothly but always to the left never the right. To make it so it bends equal amounts in both directions set init to 0 0 1 -.2 Notes: The timing periods (delay, attack sustain and decay) must be specified before commanding calculate acceleration for return calculate acceleration for return calculates for the envelope whose index is specified (currently being edited) The returning envelop should be timed (delay, attack, sustain and decay ) so that it is the last envelope to finish however the return envelope can start before the earlier envelopes finish. If any of the earlier envelopes are changed we must re-calculate acceleration for return for the return envelope. If 2 envelopes have exactly the same values but one runs on an opposite axis, the two envelopes will cancel each other out. An envelope wont work properly if attack
= 0 for the versions of Seamless3d so far
If we make the last 4 parts in the worm rotate in an opposite direction we can make our animation more interestingly complex. Delete the 4 ROUTEs TO seg4, seg5, seg6 and seg7 from the RotAccelerator. (right click on the ROUTEs in the control panel and select delete this ROUTE)
Add a RotFilter as a sibling below the RotAccelerator paste/sibling below/new/RotFilter
Set the RotFilter's angle to -1
Now we should see the last 4 parts rotate in the opposite direction
to the first 4 :)
To create a cat tail like effect we wont need the RotFilter any more
but we will add 1 more TimeSensors and 1 more RotAccelerator.
First delete the RotFilter node from the last lesson Right click on the TimeSensor and select copy
DEFine the two TimeSensors and RotAccelerators
Add a ROUTE from timeSensor1's fraction_changed TO rotAccelerator1's set_fraction Add 4 ROUTEs from rotAccelerator1's value_changed TO seg4's, seg5's, seg6's and seg7's rotation Now we should see our worm animating the same
as it did in lesson Animating The Parts
We can see from this how powerful it is to simply delay parts different amounts of time. Note. The two RotAccelerator nodes field
values
remain identical. We did not change any of the RotAccelerator's delay
fields for this lesson.
To be continued, how to make ripple effects for things like fish tails and flags Copyright © 2000-2006 Graham Perrett thyme@seamless3d.com
|