How do I write expression to move subject along the curve?

   10135   3   1
User Avatar
Member
2 posts
Joined: 2月 2011
Offline
I am very new to Houdini

I am working on this project for my school assignment



I finished the modeling, but I don't know how to animate by writing expression (using expression is part of the project, so I can't key frame)

so far, I made the big main wheel rotating by using simple expression

$F*0.4, but I don't know what to do for rest of them

basically I have to make this chair(part of chairlift) to move along the rope.

for example)

let's say I have curve(that has 30 points) that is a star shape and a box.

How do I make this box to move along the curve?


is it a good idea?

also, How do I make this curve moving..?
now i have a static rope..




please ! help me…

thank you so much

Attachments:
800px-Chairlift_bullwheel.jpg (134.7 KB)

User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
To familiarize yourself with writing Houdini expressions, you should study the Expression Cookbook in the Houdini help here:

http://www.sidefx.com/docs/houdini11.0/ref/expression_cookbook [sidefx.com]

Also refer to all the expressions in the Houdini help. The names of most functions are fairly obvious so simply parsing the names and then reading descriptions should get you there.

As for making the rope travel along it's length, you can use a Carve SOP on the closed curve/face (it should be closed) which will cause the vertices to rebuild along the curve/face as you shift the start point of the curve/face. You only need to manipulate the First U parameter to see the curve start point animate along the curve which will drive the entire effect. Follow by a Resample SOP set to even divisions and you have your animated curve.

If you Sort SOP the points by vertices, you can now copy your chairlifts to points. The Group SOP has an option where you can select m points for every n points. This way you can easily create a point group that skips a specified number of points based on the Resample. Copy chairlifts to the point group.

To get the correct orientation, use a Point SOP after the Group SOP on the curve to create an up vector of 0 1 0 and follow with a PolyFrame SOP with the Tangent name set to N or normals. Next the Copy SOP to copy the single chair to the curve point group as template points. Done.

If you want some swing based on velocity, there are so many ways to do this. CHOPs comes to mind as you can use lagged velocity to drive a rotate attribute on the points but first work out everything else.
There's at least one school like the old school!
User Avatar
スタッフ
2540 posts
Joined: 7月 2005
Offline
Here's a working prototype for you to have a look at.

There is an expression in the carve to move the chairs along the rope.

I didn't rotate the upper and lower wheels so I'll leave that to you. Here's a couple hints to help you out.
First the Resample SOP is set to resample the curve in even divisions of 0.1 units. There are two ways to calculate the length of the curve which you will need to remap the carve SOP units: count the number of points and multiply by 0.1 or use the Measure SOP. I'd use the Measure SOP as it would be more accurate. That's Houdini units in the viewport.
Now I animated the Carve SOP with an expression. The goal is to have the wheel rotation drive the Carve SOP value.
The Carve SOP works in parametric units from 0-1. Because the curve is passed through the Resample SOP, it is evenly parametrized. You can count on the First U parameter to represent percentage along the curve.
So you know the length of the curve, the percentage along the current cycle loop you are on, the diameter of the circle (therefore it's arc length), it's now down to some basic trig to get the wheels to rotate and drive the cable transform perfectly. The cable drives the wheel rotation as distance traveled.
I put a couple Transform SOPs in there for you to use as place holders.

“That” will be your expression exercise.

Once you have the big wheels sorted, you can use the same logic to rotate the idler wheels supporting the cable at mid-points.

Note: You can shape the curve how ever you want. Build in droops in the loops, bends, kinks, whatever. I placed a handy Null SOP called CHAIR_CABLE_MODEL. I did a couple edits for you. You do this by manipulating the curve above this null, say inserting more points on the straight line segment and model to suit, you can properly ease the cables coming out of the wheels. I will actually build the fixtures (poles and wheels in this case) and then put anchor points in perfect position then use an Add SOP to build the curve from points.

You can use a Spring SOP to add droop to the curve. Just put the fixed points in to a group and let the spring do it's droopiness work.

Attachments:
animated_chairs_on_cable.hip (91.5 KB)

There's at least one school like the old school!
User Avatar
Member
282 posts
Joined: 8月 2014
Online
This is awesome!

Is there a similar trick to shift the points along a curve that is not closed? I'm thinking if a dirty way would be to make a copy of the curve and run the process twice on top of each other, but one carve keeps internal and the other external thereby making it look like the curve stays intact? or is that just a huge waste of resources from a setup point of view.

thanks!
https://www.thomaskchristensen.com [www.thomaskchristensen.com]
  • Quick Links