wiki.sine.space | sinespace

Vehicles

From wiki.sine.space
Revision as of 10:34, 19 November 2018 by Eric MA (Talk | contribs)

Jump to: navigation, search

Please notice there are two versions of script for Vehicles: the old ones are the scripts like "car physics", "car vehicle", which are obsolete; the new vesion is one script called "Modular Vehicle", it combines all kinds of vehicle together(land, hover, boats) so you can adjust this one script for all vehicle settings. The new version resolved many bugs of the old version, so we recommand to use the new one. We will still keep the tutorial of old version in other pages, you can always check them if you need.

Note: This page is updating to new version so there may be some place incomplete during this moment.

Simple guide for a land vehicle: Red Truck

Truck model from asset store, consists of empty gameobject with five dependent meshes; the truck body proper and four wheels.
all else you will see on the vehicle is added during the 'scripting' process.
Redtruck.png
This is not a perfect vehicle. It's 'alright'. There is more that could be done with it, which Adam covers in the related Artist's Masterclass. It is, however a decent reference vehicle, for making vehicles that behave in a more or less expected fashion, vis a vis real life (tm) vehicles.
To prepare a model for vehicle, whether you want create one using MAYA or 3DMAX or Blender, or find a model from Unity asset store, there are somethings you should pay attention to:
1. Make sure the wheels are splited from the vehicle body. Some vehicle in asset store has a single FBX file combined all the thing together, which makes the next steps quite impossible if we don't do something to the model.
2. The edge of the wheels should be as smooth as possible. Some low polygons models cannot act very well on our vehicle system.

Preparation: When you have your vehicle model ready, follow the steps below: 1. Add wheel collider for each wheel. The value will be set later. 2. Add a collider to the vehicle body. A simple box collider which covers most of the vehicle body is enough. It is used for clickable item trigger. If you find your vehicle cannot be activated by click, check the collider here you use.

NOTE:
As it turns out, on 'realistic' terrain, this truck drives a bit like a moon buggy. For a more realistic experience, set 'Max Speed' to '15'; 'Mass' to '7500' and adjust the rear wheels such that each has 'Forward Torque' to '750' and 'Backward Torque' to '500'. On the wheel colliders (all four wheels), set 'Suspension Spring' to '6' and 'Damper' to '10'.



This is the basic modular vehicle component for the red truck. There's a few more bits to it off the bottom, but they do not apply to this vehicle.
Redtruckmodularvehiclecomponent.png

These are the 'core forces' settings. They configure the vehicle 'overall'. Everything else is pretty much 'per wheel'. Note that the first two wheels are right and left rear.
Redtruckmodvehcompcoreforces.png

This is a representative rear wheel. The other rear wheel looks identical, it's just on the other side.
Redtruckrearwheel.png

This is a representative front wheel. As with the rear wheels, the other is identical.
Redtruckfrontwheel.png

This is the collider for the rear wheel. It will be the same on the other side. Differences are in the name and position on the model. This applies generally to all the wheel elements.
Redtruckrearwheelcollider.png

This is the collider for the front wheel.
Redtruckfrontwheelcollider.png

Finally there's a trail rendering component for making tracks
Redtruckrearwheeltrailrenderer.png


There are four types of vehicles in the Space virtual world platform;

Hover

PENDING

Boat

PENDING

Tutorial for obsolete vehicle script

Land vehicles Aircraft and Gliders Hover Vehicles Watercraft and Boats