Film Tools for vehicle animation directly in Unity?

Hi Guys

Busy with a film and need to animate articulated lorries and regular cars. Are there any tools from Unity side or from the Asset Store, that I could use to animate vehicles directly in Unity?

Ideally I just want to define the wheels, body and define a path and the vehicle will drive on that path at a set speed. I DO NOT want to be manually driving vehicles “in game” with controllers etc.

Would the Cinemachine dolly cart serve your need? You can attach anything to the cart, not just a camera.

Hmmm sounds interesting. But how would I deal with the wheels turning and the front wheels left/right turns?

Yeah. the dolly cart would only work for moving the vehicle and maintaining direction. It won’t do anything specific for turning/steering wheels. I’m not aware of a specific built-in functionality for exactly this, but to your original question, there must be Asset Store plugins for this. This one looks plausible, but I can’t say for sure that it does the path following.

You could animate in a 3D program and then export it out to FBX.

I did a script in the past that tried to use the delta movement from previous frame to work out direction of movement and turn front wheels in that direction. Movement delta also gives you the speed of movement so you can work out the rotation rate of the wheels (you need to take the radius into account - I cheated I just manually typed in a rotation speed factor rather than doing the maths).

So I used the Dolly to move the vehicle, then had scripts to look at delta movements to adjust steering, and another to adjust the rotation of the wheel. I found it was smoother if I rate limited the rate of change (which I use for head turns - the eyes turn fast to look at a target, but the head rotates more slowly).

But it was not good enough in practice. You need to watch out for “ice skating”. If you use Dolly to move a long truck that goes around a sharp corner, if you just transpose the middle of the truck, as it rotates around the corner the front and rear wheels skid sideways. So I ended up using the Dolly to move the target of movement, then had scripts to work out the distance from the object to the target and ramp up/down velocity based on that. Moving towards a target meant I could work out the movement so the front and rear wheels never moved move than the velocity measure.

What was my final solution? Don’t have vehicles turning corners in the shot! Lol! Then I just animated the rotation of the wheels and transform of the truck (a scooter in my case!) in animation tracks and moved on. I did not have many such movements and all the fancy stuff was overkill. (Fun trying to code it though!)

I forgot to mention the other benefit of this approach was it made scrubbing in the timeline much more reliable, making checking the relative position of different objects easier to judge.

That is, if you scrub backwards and move the target point backwards, the vehicle in my scripts would try and turn around and go backwards (!), trying to drive towards the target which was suddenly behind it.

Instead what was wanted was like a secondary curve to be computed alongside the dolly track that worked out the rotation to avoid skidding, so you could scrub to any point on the dolly track curve and the truck would be facing the right direction to avoid wheel skidding… if that makes sense.

So a relevant question is whether you want to be able to scrub the timeline or have more natural movements. Scrubbing to an arbitrary frame sounds much harder to code with accurate movements. As I said, I avoided turning vehicles and the problem went away.

There is a demo scene in MegaShapes that shows a Rigidbody car being moved along a spline, the steering and the wheel rotation is handled by the system, whats cool is the car is free to interact with the scene, going over jumps etc even though it’s on a Spline.

2 Likes

Thanks, I’ll contact that dev for further info about their asset…

Thanks but I’d prefer to avoid any scripting if at all possible.

Ah thanks I’ll look at this one also. Sounds almost like what I need. Hopefully it can do trucks/lorries also…

That’s why my question asked specifically to be able to do it directly in Unity. I’m sure Unity will be much more responsive and easier to do. My “outside” Unity options are limited to 3ds Max and natively it does not ship with ready made vehcile animation tools. I could spend weeks and rig and script my own, but that defeats the purpose. I could also buy Madcar, but that is way too expensive and it appeasrs like you have to “drive” your vehicle in realtime while it records the keyframes. That is not what I want. I want to animate on a path or between waypoints. There’s also Craft Director tools, if they’re still around, but again, too expensive.

Look up Craft Animation Tools. They have a free plugin for vehicle movement that takes only a few minutes to rig a car and animate in 3ds Max.