Jump to content

Vehicle builder and controller


Recommended Posts

This script save you time by building and configuring a n-wheeled vehicle in second. It come with a simple controller and a gui to modify any parameter of the vehicle.

The car :Tiger.fbx
The scripts : component.zip

1. Drag and drop the .fbx in the scene, add BuildVehicle.cs component on the parent node.
The script check for the name of the node to find the parts, if you use "Get Parts With: node" the order is l0,l1,r0,r1 (front left, rear left, front right, rear right).


2. The manual work you have to do: select a wheel, create a rigidbody, add a cylinder shape, make the shape fit the wheel, note the radius, shape and rotation.

3. On "Wheels" section (image bellow), modify radius, height and rotate Shape. Now you can delete the rigidbody you created last step.
3.1 To make the driving experience better, add a custom center of mass to the vehicle, place it very close to the ground, this prevent your car to flip on every bump.

4. Enable debug to check the shapes. Add ControlVehicle.cs component to the parent node, deactivate any camera in the scene and press play.

5. You can then add ChangeParameters.cs to the parent node to change any of the car parameter, these aren't saved.
Left column is the settings of the wheel, then hull, then controller. Once you changed a parameter, note it somewhere and change it in BuildVehicle.cs or ControlVehicle.cs.

Edited by _dahu_
  • Like 4
Link to comment
  • Create New...