i’m trying to get to grips with using the car wizard outside of the race demo. I’ve taken the car folder from the latest race demo and put it in a new project, and also taken the editor folder with “CarWizard.js” in it and put that in my assets folder.
I modeled a really basic car and tried the “create car” from the gameobject menu, applied the wheels and body and clicked create… what am I supposed to be seeing? I’m not sure what its creating? can anyone please advise?
It basically does this: given your car object, if needed it creates an additional parent object (it’s needed if the pivot of your original object is not at the center).
Then it attaches the correctly-sized collider to the rood object, a rigidbody, Car and RestartWhenStuck scripts to it. Under this parent object it creates WheelColliders object, where the four wheel collider objects are created, along with a Wheel script attached to them. The wizard sets up parameters for the Car and Wheel scripts as well.
So what you should see are some new objects in the hierarchy view, wheel collider gizmos when the car is selected in the scene view; and when you hit Play you should be able to control the car!
In short, all the wizard does is automating the tedious process of creating wheel collider objects, setting them up, wiring the parameters etc.
Okay, i’ve moved all the correct stuff to the right place now, but in trying to use the Create Car wizard, I can select all the wheels and car root / body, but the Create button is greyed out… Any thoughts as to why that could be?
Did you try following what the wizard says in the dialogue? (The part about the front wheel not being in front and aligning the car body with the blue axis)
I was sure id sorted out the blue arrow alignment, but i’m gona go back to cinema and make sure every single part has blue arrow forward so i can rule that out… will post again soon…
You need to make sure the blue arrows are correct in Unity and not only in Cinema 4d. (The axes them selves might change when importing from cinema 4d)
You can also just make a new root for the car in Unity directly.
Create an empty game object. Place it at the center of the car. Make sure blue axis goes forward, red axis goes to the right
Make the car a child of the empty game object
Use the car wizard with the new root (empty game object)
Thanks for the response everyone, Joachim, I’ve placed the truck in an empty game object and it works now, but its got some wacky wheel spinning action, my axes are all wrong, but ive corrected them in cinema4D and its still not right… take a look
Make sure the wheels themselves are setup so y-axis goes up and red axis goes to the right.
What matters is that the axis are setup correctly in Unity not in Cinema 4D. So this is where you need to check if it’s setup right.
Looks like the physics is more or less ok, just the visible wheels are rotating not along the intended axes.
Car scripts in Unity expect somewhat “standard” orientation of the objects - i.e. that “up” axis (green one) is actually up, “front” axis (blue one) points forward etc. I guess what is happening here is that your wheel objects have some non-standard axis setup. So the script rotates them around “up” and “side” axes, but thes axes are actually not pointing there.
What you should do is get the wheel models so that when selected, their red axis points sideways, green upwards and blue forwards.
ive done a basic test and terrain now i have the wheels going in the right direction.
Now im confused by the way in which you cant really turn whilst accelerating, then when u let go of the accelerator, you lunge to the right/left. should it do that???
Pretty sure this is a “feature” not a bug. Play with the values that the Car Wizard set for your car, the Car script. Specifically, Low Speed Steer Angle, High Speed Steer Angle, and High Speed.
These probably need to be tweaked depending on the scale of your scene.
Okay, i’ve corrected the size of the car - it was a little too big but only by about a metre. What I would say is that maybe its the fact that I have had to adjust mass center Y and down pressure factor?
I did this to stop the car immediately rearing up on its back wheels then flipping over. Is there a better way of stopping it doing that? Because I think thats why its no longer handling too well…
I think Its important to get the size right. Add a cube to the scene and bear in mind It represents 1metre Then make sure it looks a bit like this:
It took me ages because of the way I modelled my car, so check the orientation of your wheels in c4d as well as car body. And beware of transforms that are not in the middle of your actual objects-this stuffed me up until last nite
See Size and Direction?
I’ve got the Things drag and dropped, but the colliders dont match the car body shape, as I mixed diameter and radius up in the wizard.Make the blue circles match the wheels and have the body(box)collider inside the wheel colliders
note this uploader and commenter is harder to use than Unity itself! :roll:
The car flipping over more than usual might be due to the size of the box collider. Unity automatically calculates a inertia tensor from the colliders used by the rigidbody.
In this case, a flat car is much less likely to topple over than a high truck. Thus you need the higher downforce to prevent it.
So maybe instead of using higher downforce, you adjust the collider to be more flat. Then your lorry will topple over less, without requiring higher downfoce.