Jump to content

Vehicle builder and controller


photo

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).

001.thumb.png.789b3ca89708f29382f165e305db9888.png

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.
002.thumb.png.c985f561748dafd74204a7319cb6ae89.png

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.
003.thumb.png.1ef525190e66c8be404bf34f72754bde.png

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

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.
005.thumb.png.68e5ead3d4ffedadcd8e254ca984b782.png

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