Spring Controller

 

   

Animation Controllers - Quick Navigation

The Spring controller adds secondary dynamics effects to any point or object position. The end result is secondary mass/spring dynamics similar to Flex. This constraint adds realism to generally static animations.

When you apply Spring to an animated object, its original motion is preserved and secondary, velocity-based dynamics are applied. When you first apply the controller, it constructs a virtual spring between the object's original position and where it would end up after forces are applied to it. You can adjust spring tension and dampening. Increasing the tension creates a tighter spring, while increasing the dampening smoothes out jitters in the motion.

Users have control over the point's Mass and Drag, the spring's Tension and Dampening, and other world space constraints. These include being able to add external forces like Wind and Gravity (spacewarps), and being able to constrain the spring effects along a given axis. This way you can add vertical dynamics while controlling the about of effect it has in the horizontal directions.

The solution is calculated using a start time and a step size. Solutions are cached once for the last tick calculated, and once per frame. Performance should be the same one each frame as you step forward, and significantly faster after the first pass if nothing changes. Cached values will be used if going backwards in time.

The biggest slowdown occurs when animating an object that the controller uses as a force way down the time line since this is a history dependant solver. If a lot of animation is going to occur along a long timeline you can shut off the spring solver by setting steps to 0. Set this back to the desired value when you want the solution recalculated.

Methods

<float>getMass () 	 

Returns the mass.

   

<void>setMass <float>mass   

Sets the mass. The mass of the object to which the Spring controller is applied. Increasing the mass causes the "bouncing" spring motion to become more exaggerated.

   

<float>getDrag () 

Returns the drag.

   

<void>setDrag <float>drag 

Sets the drag. Acts as air friction on the spring motion. A low Drag setting results in a greater "bouncing" effect, while a high Drag results in subdued bouncing. Default=1. Range=0 to 10.

   

<float>getTension <index>springIndex 

Gets the tension for the spring corresponding to the index.

   

<void>setTension <index>springIndex <float>tension 

Sets the tension for the spring corresponding to the index. The "stiffness" of the virtual spring between the controlled object and the highlighted spring object(s).

   

<float>getDampening <index>springIndex 

Gets the dampening for the spring corresponding to the index.

   

<void>setDampening <index>springIndex <float>dampening 

Sets the dampening for the spring corresponding to the index.:Acts as a multiplier of an internal factor that determines how quickly the object comes to rest. With the Self Influence spring, changing Dampening has the same effect as changing Drag. With other springs, Dampening affects only the movement caused by that spring. Internally, the dampening value is proportional to the tension, so as you increase the tension and make the solution more stiff, the dampening is increased to maintain system stability.

   

<boolean>addSpring <node>node 

   

<node>node 

Adds the node to the spring list.

Returns true if successful, false otherwise

   

<integer>getSpringCount () 

Returns the number of springs in the spring system.

   

<void>removeSpringByIndex <index>springIndex 

Removes the spring corresponding to the index.

   

<void>removeSpring <node>node 

Removes the spring if the node is in the spring list.

   

See Also