PDA

View Full Version : Odometer?



ninok5
06-27-2003, 12:31 PM
Is there such a thing in lightwave, perhaps a plugin that would report the final distance an object has traveled which can be accessed by the expressions.


Im haveing issues with a few things and something like this would really help me out.

Problem: Trying to spin the tire based on how far a car has traveled (total distance, wheater its going forward, then back, etc, but not only on 1 axis.

Right now i have the tire spin based on distance in x,y,z, its parent moves. Basic math only, car circumfrence 4m, Distance 8m, spin 2 times 360 degrees for 720 degrees of spin, ez. What about complex curves, slow down, speed up. I need a way to calculate so i dont have to bother with manual tire rotation on complex turns.

ANY help is greatly apprechiated. Thanks a lot!

SplineGod
06-27-2003, 02:19 PM
Do a search on flay using the keywords:
Distance
Wheel
It brings up some useful looking tools. :)

wacom
06-27-2003, 03:41 PM
Originally posted by ninok5
Is there such a thing in lightwave, perhaps a plugin that would report the final distance an object has traveled which can be accessed by the expressions.


Im haveing issues with a few things and something like this would really help me out.

Problem: Trying to spin the tire based on how far a car has traveled (total distance, wheater its going forward, then back, etc, but not only on 1 axis.

Right now i have the tire spin based on distance in x,y,z, its parent moves. Basic math only, car circumfrence 4m, Distance 8m, spin 2 times 360 degrees for 720 degrees of spin, ez. What about complex curves, slow down, speed up. I need a way to calculate so i dont have to bother with manual tire rotation on complex turns.

ANY help is grea
tly apprechiated. Thanks a lot!

It seems odd that you can't report the speedometer readout to an expression...I don't see why we can't. Am I missing something too?

toby
06-27-2003, 06:54 PM
I know I've seen a pretty basic expression for a wheel somewhere. Try
http://www.richardbrak.net/
He must have it, if not under "Expressions" then in his tutorials, which includes a great expressions tutorial.

ninok5
06-27-2003, 09:29 PM
wacom, im not sure but thats irrelevant :). I need the total distance. I was using the speedometer as an example :) of what lightwave has, and then what i need, which is an odometer of sorts, something that measures the aboslute distance of the object traveled. Sorry for the confusion :).

Thanks for all the help guys, i will see what i come up with and then report back so that others can get the help if they so require. Thanks again!

06-29-2003, 03:46 AM
Am I right in thinking he's asking for something a lot more complex than he thinks, if you see what I mean.
Let me expand;
In order for a wheel to appear rotate properly with respect to the ground beneath it, you would always need to know/record the absolute position and orientation of the centre of the wheel at every frame; the change in position between two adjacent frames (considering only the element perpendicular to the axis or rotation) alowing you to calculate the rotation of the wheel between the two frames. To do this you will have to either somehow keyframe the absolute position of the wheel centre at every frame, or derive a mathematical function for the whole trajectory of the wheel . Pretty easy for a straight line or eliptical journey, but very, very complex for a 'real' one !:confused:

ninok5
06-30-2003, 09:32 AM
Originally posted by [email protected]
Am I right in thinking he's asking for something a lot more complex than he thinks, if you see what I mean.
Let me expand;
In order for a wheel to appear rotate properly with respect to the ground beneath it, you would always need to know/record the absolute position and orientation of the centre of the wheel at every frame; the change in position between two adjacent frames (considering only the element perpendicular to the axis or rotation) alowing you to calculate the rotation of the wheel between the two frames. To do this you will have to either somehow keyframe the absolute position of the wheel centre at every frame, or derive a mathematical function for the whole trajectory of the wheel . Pretty easy for a straight line or eliptical journey, but very, very complex for a 'real' one !:confused:


Bingo!

Yeah in a straing line, its no problem, but its been a while since ive had to do intergrals and derivitives, and even at that, i dont know the formula for lw's bezier curves. I was hoping for something that might exist already, or a plugin of some sorts that can look at every keyframe or those little white dots along a path curve and add up all the straight line pieces for a close approximation of the curve or something...

perhaps i could write an expression method? a loop of some sorts that would do this? gah, i dont even have the slightest idea of evaluating a channel through an expression at a given frame.

Anyway, ill dig around for more ideas. Thanks for the help so far guys.

SplineGod
06-30-2003, 12:32 PM
Ive seen a plugin/script on flay that give the total length of a curve. Along with that you can always turn on align to path so you dont have to worry about the tire keeping aligned. Then all you have to worry about is the rotation. :)

wacom
06-30-2003, 01:13 PM
Sorry about my post earlier, I just thought that since the Speedometer messured rate that it must also account for distance. I'm not great with math, I just thought r = d/t ...etc etc. I thought that since the Speedometer plugin must use this info somehow it would be nice to be able to extract it and or pass it to the assigned object(s). I too have come up with expressions that delt well with turning a wheel correctly as long as it was in moving in the "positve" quadrent of Layout with X,Y,Z values above 1. I used the average change in X,Y,Z over time to affect the turn rate of the wheel.

So sorry if it seemed off base and I was (and am still) way off, I just thought it would be nice to use Speedometer's monitor of r,t, and d for our own uses as it works with any path direction.

ninok5
07-01-2003, 09:43 AM
hehe dont worry about it wacom. I didnt make myself clear either. Thanks for the help anyway.

I did manage to come up with a way to move the tire correctly, but its a bit tedious. It is ok considering i get correct tire rotation, and in the end, thats all that counts.

The way which i use now uses the plugin splineGod is talking about to measure length of the spline and also lightwaves cycler to rotate the wheel. The reason this is tedious is because you have to do it for every tire with their own nulls (unless you want to fake it and have every tire rotate the same but, that doesn't look right unless the car is going straight forward.


Again, thanks for the help guys.

Arnie Cachelin
07-01-2003, 10:17 AM
The Cyclist motion modifier can drive a wheel rotation based on the path distance traveled. Naturally it has to integrate the motion over the entire (previous) animation. To get the speed, one only needs to evaluate positions at 2 different times.