Jump to content

plz, need some help with expressions


calin_casian

Recommended Posts

I'm trying to animate a car running down a track. I use path obj. for the car to move but now I have to turn wheels as well. The parameter orient along path keeps the vehicle tangent to the path. How can I use this to rotate my wheels along Y, or something else?

thx,

calin

Link to comment
Share on other sites

hello,

Using the "deg" expression you can convert translation values to rotation values. In your case, since you are using a path object you need to find how much the object is translating. At the moment, the only way I can think of ( unless anyone can think of another way ), is to find the bounding area of the path object and compare it to the bounding are of the car. This way you can use CHOPs to fetch in the path value, just incase the car goes backward at any time, then follow that with a Math CHOP to multiply it by the difference between the bounding values. Then follow that with an expression CHOP with the expression:

deg($V)

Then export that value to something like the Primitive sop's rotation.

Andrew

Link to comment
Share on other sites

A little high school math recap

perimeter of circle = 2*PI*r so in one rotation (360 deg) your circle will travel a distance of 2*PI*r...

So for any distance x your circle should rotate x*360/(2*PI*r) or in Houdini 360/(PI*$BBY) where $BBY is the bounding box of your tyre. Actually the expression will look more like

distaceTravelled*360/($PI*bbox("/obj/tyre",D_SIZEY))

Since you are using a path you won't have translate values for your car for which you'll need to use chops

Use an object chop and then a slope, that should give you the velocity vector( and direction as a perk :) just in case you want to automate steering too ) The length of this vector is the distance your car travels in each frame,

Hope this helps

Link to comment
Share on other sites

well, tallkien I think you get it wrong or I don't know enough english (since it's not my mother language, it happend before) to explain my problem. It's not the problem about rotating the wheels to give the impresion that the car it's moving forward it's the "steering", my up axis is Y that's why I asked how can I rotate the tire in Y acordingly to the path. But I guess the answer to my solution is in your reply (about that CHOP stuff)

thx

calin

ps. btw I know the relation between the circle lenght and how many deg it must be turn to cover a given distance

Link to comment
Share on other sites

not exactly sure what you are trying to acheive, are you trying to get the steering to look correct. If that is it, you may try use set the normals of the path to face their correct tangents and rotate the tires based on the curves normals directions. If this sounds like what you are looking for, ill try to go further on it.

christopher

Link to comment
Share on other sites

I don't think curve normals would offer a very accurate solution for orienting a car's steering wheels. Ideally if you were to put a car on a path, the pivot of the entire car would be at the center of the rear axle. If you sample the direction vector of a point on the front axle (which will be different from the rear) it becomes easy to simply orient the front wheels to this vector, which I think is what calin ended up doing. This would also make the system generic so it won't matter if you animate with a path, keyframes or any other way

Come to think of it, you can use the same technique to orient the whole car itself, so all you have to do is animate just the position of the car and let Houdini do the driving so to speak B)

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...