PDA

View Full Version : Rotating a wheels ?



Lewis
07-26-2014, 04:55 PM
Hi!

Can somene tell me what are way we cna use in Lw to animate rotation of car wheels easiyl wihtout keyframing them ?

So far I've used Relativity DR.Wheeler and that worked fine in past (you just move car as you want and wheels rotate automatically) but when it's used with Lw 11.6 SplineControl in Layout (for car path) it goes to crawling speed after 3rd wheel (up to 2 wheels all fine but 3rd then it's all gone to 0.0001 FPS).

So is there any other way to autimatically rotate wheels on Bank channel and still use spline control for a path?

Thanks.

Slartibartfast
07-26-2014, 05:04 PM
123253

never tried with splines... Here is a scene I played with a long time ago if you or anybody else is interested. Not perfect, but if I remember correct it was a test with banking according to speed. Play around if you like.

Lewis
07-26-2014, 05:19 PM
Thanks. I've exmained it and tried to apply to my car scene (only 65k polys in scene) and it's instant lockout/non responsive when i apply that modifier to my tire which is child of car body whicg goes over splien path with splinecontrol option.

So i guess important key factor is tool whcih works good with splinecontrol :).

Nevertheless thank you for setup, it's nice for some other cases where i wouldn't need splinecontrol :)

probiner
07-26-2014, 05:45 PM
http://forums.newtek.com/showthread.php?136328-Nodal-motion-Wheel&p=1330347&viewfull=1#post1330347

Also using motion info, and that might be what is killing performance also in Slartibartfast's scene... But that's the rotation formula ( rotation = 360 * distance / (2 * Pi * radius) ) + a little bank rotation.

Cheers

Lewis
07-26-2014, 05:56 PM
Thanks for link

I'll post scene soon (waiting for upload) :).

Main Challange is:

1. It has to be native (no 3rd party nodes/plugins)
2. Must be working on/with spline control feature for easy adjusting of path (so no baking either ;))
3. Needs to be relatively fast with 6-7 cars in scene
4. Would be good if settings could be copied from wheel to wheel without too much fuss/setup time (car is not main focus on scene so usually there is no time to spend hours on perfectign car movements/rotations...)

:)

Lewis
07-26-2014, 06:13 PM
Here is the scene/video
https://www.dropbox.com/s/b8istng53040jmf/Car_on_Spline.rar

probiner
07-26-2014, 08:36 PM
All done with Nodal Motion. Hey, I'm comfy with nodes :D
TrueArt's Node Library "Degree to Radian" node is the only 3rd party I'm using in this for comodity. If you want just multiply by Pi and divide by 180 for the same effect.

http://i.imgur.com/6v51Ycv.png



Aahhh wouldn't it be nice if this below was actually a scene graph? :D If you open the scene you'll see both Distance Control and Wheel Rotate nulls, and this will make more sense.


http://i.imgur.com/FQ8GvGA.png

If you need more info, ring.

Cheers

Silkrooster
07-27-2014, 12:52 AM
Interesting...

Slartibartfast
07-27-2014, 02:15 AM
123264

Try this Lewis. Performance is ok now, but you need to tweak wheel sliding etc.

Edit: updated scene for nicer steering :-)

Mr_Q
07-27-2014, 02:20 AM
hmmmmm

Slartibartfast
07-27-2014, 02:42 AM
@Mr_Q - yeah, nodes are seriously fun ;)

probiner
07-27-2014, 07:18 AM
@Slartibartfast That's very similar to what I did ;)

Only problem in that scene is that you can't feed directly the Pos.Z of the CarBody to the wheels because the car is spline controled, so the Z read by the node is not the Z that controls the Spline Control anymore, but the Z over the Spline. So the wheel will not turn if the spline goes on X axis direction and it will even turn backwards if the spline goes on -Z flow. If you check the last section of the time-line you'll see it happen.
Hence there needs to be a Distance Control null so the Z that controls spline control can always be read by the nodes.

Cheers

Slartibartfast
07-27-2014, 08:12 AM
I was actually wondering wich Z would come out of the iteminfo node, and I took a chance. It appeared to work at a quick glance but then I didn't have more time to test. How would you drive the "fake" z-channel on the car with that null? Same as item i guess must be set to spline ctrl. A follower or expression? Thanks for the heads up anyway.

probiner
07-27-2014, 08:20 AM
Just did with Nodal Motion, but channel follower works just as well. So basically for each car there is a Z master control.
Alternatively, you can have any fake/arbitrary channel though from any envelope you have on an object. So say you open the Displacement node editor and you put a scalar there with an animated value. Sliders will see that and so will channel follower.
If this was Softimage I would probably create a custom parameter and animate it and not a null though.

I didn't do this, but it would be an option (gave an offset on the curves so you can see the difference). Notice the scalar node is not even connected.
http://i.imgur.com/07tCoGt.png

What I'm hating right now in LW though is that if you have 0 keys the values always reset to the default. In this case in particular is not an issue. But if you have a slider or an item you want to change the value you have to open the graph editor to change at the key the value is set. You can't just have it like a property that simply is not keyed but retains whatever you dial in. So building Custom parameters this way is kind of crippled for me.+
PLUS... normally you won't see them with nodes. Pom Nodes Store Material does this for node values only. Very close to what Softimage ICE does. Set custom attributes, then Get them somewhere else, but never tried it in production. And given that even sometimes "Item Info" references break at times... It's a matter of test.

Here is how the Nodal Motion of the wheel would retrieve that same animated scalar value on the CarBody Nodal Displacement (scalar node with envelope), in your scene.

http://i.imgur.com/vfFH1mH.png http://i.imgur.com/EscYYTx.png


Cheers

RebelHill
07-27-2014, 08:47 AM
Why not just use a plain ol expression...

vmag((Null.wpos(Frame)) - (Null.wpos(Frame- 1)))

Will give the total distance traveled (in this case by "Null") between the current and last frame. Therefore no need to worry about which axis the motion occurs on.

Slartibartfast
07-27-2014, 08:50 AM
@probiner: Ok thanks, I saw RH's tut about splines and remember the difference between z and z. It is a little bit confusing having motion options/zpos controlled by spline and at the same time control it by other means. But I guess the motion options for z actually just copies the "real" z-channel, not actually controlling it. Hence no conflict?

Slartibartfast
07-27-2014, 09:07 AM
Why not just use a plain ol expression...

vmag((Null.wpos(Frame)) - (Null.wpos(Frame- 1)))

Will give the total distance traveled (in this case by "Null") between the current and last frame. Therefore no need to worry about which axis the motion occurs on.

There is probably no good reason not to use that in general :)
I was in nodal mode and didn't want to mess with time-nodes since i was worried about a performance hit.

Slartibartfast
07-27-2014, 10:26 AM
I had to try some more ;). Now with the master-Z-null solution probiner suggested. And I put a bone in the car to keep both axles on the road. I think it looks ok from a distance. Don't you agree ;D?! RH :bowdown: and others might think it's kindergarten, but at least _I_ learned something :thumbsup:.
Btw, I first tried nodal motion/follower. Didn't work. Graph editor/modifiers/channel follower worked though. Probably due to order of evaluation?

Locking differential might be a problem at close range and sharp turns.

123276

Lewis
07-27-2014, 02:31 PM
Thanks for brianstorming guys. I'll examine this and let you kwno how doe sit work in real wordl situation when i get 10+ car sin scene. Hopefully performance will be usable there also ;).

Lewis
07-28-2014, 12:36 AM
123264

Try this Lewis. Performance is ok now, but you need to tweak wheel sliding etc.

Edit: updated scene for nicer steering :-)

This works great, thank you very much for scene.

Now on to question(s) ?

Why do we need steering Target null ? Can't it work with single null or even car body ? Just trying to minimize setup time not sure is it doable and not really node guru to explain to myself how/why :).

thanks

Slartibartfast
07-28-2014, 01:15 AM
Great!

You are right- we don't need two nulls. One is enough. Just follow the heading on that one. Zero nulls could work but you'd want to look ahead using expressions or timenodes etc. It is probably easier to set up a null.

Cheers

Slartibartfast
07-28-2014, 03:16 AM
Bummer! I just presumed the diameter of your wheels was 0.6m from your video. Together with a math error I made in the nodes it just looked ok by chance. Now the actual diameter is .75m and here is a scene with sane maths. There is also only one steering null. I've commented the nodes and made some markings on the wheels to make it easier to see that it is working. Sorry for the mistake (I put a multiply instead of a divide, and used diam instead of radius).

123299

Lewis
07-28-2014, 03:30 AM
excellent, thanks one more time :)

Lewis
07-28-2014, 02:08 PM
Ok another stupid question, now when I'm trying to incorporat ein rela car/scen i got stuck wiht some issues.

1. My car is fliped on Z (fackign -Z instead +Z axis) due soem othr app export and some LW vertex maps issue i can't just rotate it in modeler (kills the smooth groups/vertex normals) so i have to rotate it -180 in H at layout and that creates new set of problems, My front wheels/rims then get inverted (flipped inside out :)) :)?
2. I don't understand why do we need this Bone ? what's the purpose of it inside of this rig ? Can it work similar without that ?

Thx

Slartibartfast
07-28-2014, 04:38 PM
It's not stupid at all. I'll try to help you with this. I'm assuming your car and tyres have pivotpoints and all in order.
Splines is thinking positive Z is forward, so just rotating the car 180 degrees will not help. There is as usual several ways to do things, but I added a null called z_correction. Make it the parent of the car and then rotate the car 180 degrees. (temporarily parent the wheels to the car before doing this) Then make this null follow the spline instead of the car. Now, as you saw the wheels aren't behaving themselves, so we have to adjust the nodes:
1: multiply pitch by -1 so they rotate in the right direction
2: add 180 degrees (pi radians) to wheels heading

See picture below. I removed the bone, wich was just a test to get both the front and back of the car to stick to the spline and not drifting so much sideways at sharp corners. You don't need it and it doesn't solve the problem completely.

123314

You are welcome to ask more questions here or PM me if I was unclear.

Lewis
07-28-2014, 05:53 PM
Thanks for more info, starting to almost make sense for me nodal begginer - slowly :D :D.