Jump to content

using Python to animate an object


sim

Recommended Posts

Hi all,

I'm trying to use Python to solve an animation problem I have. I must say I'm very new to Python in Houdini. And I can't even be sure if it's Python that I want to use to solve this problem.

 

I have a curve created by joining together a bunch of nulls. I animated the shape of the curve by  keyframing the nulls positions. Though however I change the curve I need to keep it at a constant length.

Two of the nulls and part of the curve is off-camera and they're free to move any where.

 

I figured I could use a Python expression in conjunction with measure sop to iterativley move the two hidden nulls to maintain a constant length. Though I've had no luck so far.

 

I'm not even having much luck getting Python to something simple like making one box follow the keyframed position of another box over time. I can set the position when I press 'Apply' for the code in my Expression Editor. However it doesn't update when I play the timeline.

 

I've looked for Python examples for this kind of stuff. I've found lots on tool creation and creating and modifying nodes, but nothing yet on animation.

Can anyone point me to an example that could help me?

 

Or is Python even the best way to solve this? Should I perhaps be trying to do something in chops?

 

'cheers,

Simeon

Link to comment
Share on other sites

  • 3 weeks later...

 if you turn on "even length segments" on the polyspline sop you can effectively set a maximum length for your curve .. does that do what you want ?

 

 -G

 

 

Hi all,

I'm trying to use Python to solve an animation problem I have. I must say I'm very new to Python in Houdini. And I can't even be sure if it's Python that I want to use to solve this problem.

 

I have a curve created by joining together a bunch of nulls. I animated the shape of the curve by  keyframing the nulls positions. Though however I change the curve I need to keep it at a constant length.

Two of the nulls and part of the curve is off-camera and they're free to move any where.

 

I figured I could use a Python expression in conjunction with measure sop to iterativley move the two hidden nulls to maintain a constant length. Though I've had no luck so far.

 

I'm not even having much luck getting Python to something simple like making one box follow the keyframed position of another box over time. I can set the position when I press 'Apply' for the code in my Expression Editor. However it doesn't update when I play the timeline.

 

I've looked for Python examples for this kind of stuff. I've found lots on tool creation and creating and modifying nodes, but nothing yet on animation.

Can anyone point me to an example that could help me?

 

Or is Python even the best way to solve this? Should I perhaps be trying to do something in chops?

 

'cheers,

Simeon

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...