PDA

View Full Version : Creating and animating a spring?


spuddle
06-03-2006, 03:23 PM
Hi people,

I'm working on a jack-in-the-box style character and have created a spring for him using 'create polymesh from curve' which is in this case is a spiral curve.

I can see that the height of the spring can be now animated by adjusting the height of the spiral curve but I'm having difficulty working out the best way to constrain the curve to some directional entity.

If you can picture it, the base of the spring needs to stay in the same place but the tip will be following the location of the puppet character sat on top. I need the whole mesh to bend like a spring will. Is this complicated to set up or have I missed something obvious?

Thanks in advance.

TheLostVertex
06-03-2006, 10:50 PM
Here is a simple spring with controls for its position and length. Took about3-4 minutes to set up. If that is what your looking for just reverse engineer it, it should be pretty straight forward.

Cheers
-Steven

upvector
06-03-2006, 11:07 PM
-Draw a curve the length of the height of the spiral
-deform your spiral along this curve.
-create two clusters with center on this curve, one on the base, the other on the tip.
-contraint the tip cluster center to the character.

now the fun part:
-RMB click on the "curve" divot under "scaling along" set of params in the CurveDeform PPG, choose "set scipted operator".
-In the scop editor click on the new button and navigate to the "Nurbs curve list", under the curve object you're using for the deformation.
-paste this into the scop:

set oGeo = inCrvlist.value.geometry
out.value = oGeo.length/ put here the height of the spiral

-Click apply, and you're done.

Cheers
Gianfranco

spuddle
06-03-2006, 11:38 PM
Wow, thanks Steven!

I don't think I could have come up with that solution on my own. It works really well though!
I'm going to have a play about with some variations now. Cheers again.

-myles

spuddle
06-04-2006, 12:18 AM
-Draw a curve the length of the height of the spiral
-deform your spiral along this curve.
-create two clusters with center on this curve, one on the base, the other on the tip.
-contraint the tip cluster center to the character.

now the fun part:
-RMB click on the "curve" divot under "scaling along" set of params in the CurveDeform PPG, choose "set scipted operator".
-In the scop editor click on the new button and navigate to the "Nurbs curve list", under the curve object you're using for the deformation.
-paste this into the scop:

set oGeo = inCrvlist.value.geometry
out.value = oGeo.length/ put here the height of the spiral

-Click apply, and you're done.

Cheers
Gianfranco

Great stuff, I'll try this method too!
Most helpful.

janimatic
06-04-2006, 09:21 AM
hey

I don't have scripted ops feature...
To get a kind of tail setup controlable from both sides, you could also do the curve's cluster centers like others said, duplicate each null center controler and for each :
- select the original, then the duplicate and run ApplySpringOp();
- the spring operator can be found under <objectWithSpring>/Kinematics/global Transform/Spring
This is just a shortcut for the spring op, of course you should better write a script matching your needs.

You could also replace springs by position constrains with animated weight values

I wish the next version will make the use of spring more clear and obvious, and also add particle based softbodies....

TheLostVertex
06-04-2006, 08:43 PM
hey

I don't have scripted ops feature...


To get the same effect, open the ppg for the spiral, right click on length and set and expretion on it so that the distance between two objects will be the length of the spiral. it is something like "ctrl_distance( null1, null2 )" though i may have the syntax slightly wrong. No scripted ops required for all you foundation users :)

-Steven

upvector
06-05-2006, 01:13 AM
That's totally true, Steven...And to be honest I really liked your kind of set up! :)

Cheers
Gianfranco

CGTalk Moderation
06-05-2006, 01:13 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.