Wheel Rotate based on distance

   12892   4   5
User Avatar
Member
190 posts
Joined: April 2009
Offline
Hi all,

I have searched extensively to find a “car-rig”-like solution to make wheels rotate based on the distance they have traveled.
I came across: Lyonz thread: (http://forums.odforce.net/index.php?/topic/13258-direction-spin [forums.odforce.net]) but that didn't came up with a solution.
I found tyson ibele's elegant solution in 3Dmax over here: http://www.simplycg.net/viewtopic.php?f=32&t=4630 [simplycg.net]

So i started to try to get a simple version of that in Houdini.
For this i want to calculate the total distance traveled and here comes the first trouble. I calculated the distance traveled in the last frame.
I created a null that does follows a path, and in chops offset it to 1/$FPS. Then subtract the second from the first and you've got the distance traveled in the last frame.

So my idea was: get the rotation of the wheel and add (distance * (360/2*pi*wheelradius)
But this isn't working because in sops += doesn't work as explained here:
http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=20063 [sidefx.com]

Alright, so i thought i'dd get the totaldistance covered so i brought it into dops and use a sop-solver, similar to how Peter Quint explains here:
http://vimeo.com/6663811 [vimeo.com] but i'm getting into trouble again. I CAN get the distances calculated in a vopsop in the sopsolver in dopnetwork but i just can't get them properly added to the already existing distance.

Needless to say, I'm starting to feel a bit stupid and i could really use some help. Maybe someone could shed some light on this?

Thanks in advance.

Rudi



User Avatar
Member
190 posts
Joined: April 2009
Offline
I have found a solution to the “total distance” problem using a Python script in chops that is very well explained by Steve Twist on 3DBuzz's Technical Rigging V.
User Avatar
Member
321 posts
Joined: July 2005
Offline
This is quite easy, assuming you're writing out some steps to disk. Once your car animation is complete, delete all but 4 points, one from each wheel (you could use some point on the axle, or really any point if the wheels aren't turning). Write out this as a sequence to disk. This will be fast to read back in because it's only 4 points per file. Next, load back in with a file SOP followed by a trail SOP. Set the trail SOP length to $F and ‘connect as geometry’. Presto, you have your 4 tire marks. Now use a ‘measure’ SOP to measure the perimeter of these. Use a prim() function to get access to the primitive attribute, and use that in your rotation calculation.
Antoine Durr
Floq FX
antoine@floqfx.com
_________________
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Antoine's method works well.

Here's another that uses CHOPs. I have my own Distance CHOP HDA that I use to quickly calculate distance of anything travelled. Then you can do the trivial trig to rotate the wheel.

Have a look at the attached hip file on one way to do a rotating wheel along a path..

Attachments:
rotating_wheel_from_points_in_SOPs.hip (169.8 KB)

There's at least one school like the old school!
User Avatar
Member
37 posts
Joined:
Offline
Hi everyone. I stumbled on this thread and was wondering if you've tried using the Area Chop. It's my go-to node for measure distance. Usually I use a trail sop ( like Antoinne did ) but I only trail it for one frame. I measure t he distance between current and previous frame. Then I store that in an attribute that I pull into chops using a geometry chop. Following that with an area chop gives me a cumulative distance traveled between whatever frame range you choose.

hope this helps.
jonah
  • Quick Links