View Full Version : Wheel Spin

squarewulf

04-17-2015, 10:38 AM

I know you can use relativity, but i can only seem to get it to follow one axis. Is there a way to have the wheels spin based on the total distance traveled, as opposed to the distance in (x,y,or z) from an object? Maybe also a differential? I know there is a way, but I think i'm just looking in all the wrong places.

MonroePoteet

04-17-2015, 07:51 PM

Yes, the formula for calculating the Pitch rotation along a path where the Heading is aligned to the path is simple: the rotation in radians is the distance travelled divided by the radius of the wheel / sphere:

Pitch = Distance / Radius

This can be fed directly into the pitch channel of the NodalMotion rotation vector.

Sadly, LW doesn't provide a "total distance travelled" node, and the DPKit Motion Info node doesn't work at all from what I can tell.

I thought the problem could be solved by using a Spline control for the wheel position. The key-framed Z position along the Spline would be the total distance travelled. Unfortunately, the Spline control overwrites the Position information available to the Item Info node(s) with its calculated position information, including the Z value.

So, the basic issue is how to determine the total distance covered along the path that the object covers. This can't be calculated from the (x,y,z) values at any frame. If you can find a way to determine the total distance covered along the path and align the Heading to the path, then the solution is simple.

FYI, for a sphere, it becomes much more complicated. Because the orientation (i.e. local coodinate system) changes along the path of the sphere, the rotation required to move from point (x ,y ,z) to (x', y', z') depends upon the entire cumulative rotation to that point.

mTp

Sensei

04-18-2015, 12:05 AM

I am not sure whether it's still working but

TrueArt's Node Library http://www.trueart.eu

Extended Item Info node has output Speed (Velocity vector).

It should work with only keyframed items (so need to bake item motion to temporary null item f.e.).

If you plug it to Math > Vector > Distance,

you should have scalar velocity.

When item moves from x0,y0,z0, to x1,y1,z1, traveling dx,dy,dz

it's distance sqrt(dx^2+dy^2+dz^2) as scalar.

and

2*PI*r is wheel circumference.

It should be straight forward way to angle you need to rotate wheel..

MonroePoteet

04-18-2015, 07:57 AM

Yes, going from one frame to the next will rotate a particular amount based upon the formula described. The DPKit Item Info node can acquire the object's position at any frame as well, which can be used to determine (dx,dy,dz) directly with a vector Subtract node.

However, the rotation at the prior frame (x0,y0,z0) depends upon all of the prior frames, and cannot be calculated simply using (x0,y0,z0). For example, if the path used to get to (x0,y0,z0) is curved, the cumulative rotation at that point will be more than if it got there with a straight line.

The rotation information available to the Item Info node is keyframe information, not cumulative information. In order to calculate the cumulative rotation for frame F, you'd need start at frame 0, step through all the prior frames, perform the given calculation for each successive position and store the accumulated rotation somehow.

As well, you'd need a Sqrt node, which isn't included in the basic LW Math nodes. One is included in the AS Math node:

https://www.lightwave3d.com/assets/plugins/entry/as-math-node/

mTp

squarewulf

04-20-2015, 11:29 AM

This has been a HUGE help, thanks a lot!

I feel like I know a decent amount about LW, but then I find myself learning so much new stuff everyday.

RebelHill

04-20-2015, 11:36 AM

the rotation at the prior frame (x0,y0,z0) depends upon all of the prior frames, and cannot be calculated simply using (x0,y0,z0). For example, if the path used to get to (x0,y0,z0) is curved, the cumulative rotation at that point will be more than if it got there with a straight line.

You can use DP motion info node to get distance travelled between startTime>time.

you'd need a Sqrt node, which isn't included in the basic LW Math nodes.

Use Pow(0.5)

MonroePoteet

04-20-2015, 12:00 PM

I tried everything I could think of to get the DP Motion Info node to work, but always got zeros as output. The instructions say that "self selection doesn't work", which is where I need the data to calculate the rotation in the object's NodalMotion graph, but I couldn't even get it to work on an auxiliary Null I placed with the same Motion Path. Is there a trick to this?

RE: Pow(.5), good idea, although it's only a Scalar function. I also found that there's a Distance node in the default LW Math=>Vector node set. Turns out in either case, I needed to propagate the sign, since a pure distance doesn't tell me which direction I need to rotate, just how much. But, I'm still unable to get the DP Motion Info node to work where I need it, though.

mTp

RebelHill

04-20-2015, 12:12 PM

Vector distance is a straight line vector between 2 points, motion info gets the path distance. It should work by having another item that matches the item being driven, have a fiddle with world coords and also store path setting. And yes, it returns distance as an absolute value, so youd need some other fancyness in there to get back rolling and such.

Not sure what u mean about pow being a scalar function... pow(0.5) is the same as square root. You cant square root a vector... only the scalar values of its components (or sum of the squares of components, etc).

MonroePoteet

04-20-2015, 06:04 PM

Got it to work, thanks! I created a Spline, set it up for the path of a wheel. In the Item Motion => Controllers and Limits, turn the Pitch and Bank channels back to Key Frames so the Pitch can be calculated by the Nodal Motion setup. Then added a Null using the same Spline, and was able to pull the DP Motion Info distance data to calculate the rotation.

I couldn't get it to work with Align To Path in the Controllers and Limits. When set to Align to Path, it doesn't update the rotation information, so when the Nodal Motion setup sets the Rotation, the original Key Framed rotation in Heading is applied (i.e. no longer aligned to path).

Here's a simple example scene. Note that I intentionally lifted Node 4 of the Spline off the ground to check non-level motion a bit.

mTp

4dartist

10-14-2017, 04:42 PM

I know this has been solved probably many times, but I found this thread in my searching and not many others, so if someone else stumbles here like i did I wanted to drop this info:

So much searching and finally found the solution and it's so fantastically easy. Thank you Mike Green, if you were near me I would kiss you and buy you a beer. In any order. Especially because it's Mac/Intel.

Rotation of wheel, no matter the direction. Free plugin sitting on lightwave's website. Very easy to use.

https://www.lightwave3d.com/assets/plugins/entry/wheel/

Powered by vBulletin® Version 4.2.3 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.