-
-
Notifications
You must be signed in to change notification settings - Fork 49
Vehicles
Dan Royer edited this page Jun 11, 2023
·
4 revisions
The vehicle factory is available from Demos > create vehicle
.
- Type: choose from one of the available types.
- Wheel radius: radius of cylinder.
- Wheel thickness: length of the cylinder.
- body length: length on X. Also sets the wheel base, which affects turn radius of motorbikes.
- body width: length on Y. Also sets the distance between wheels, which affects turn radius of cars.
- body height: length on Z.
- body radius: only for omni vehicles.
- ground clearance: Z distance from bottom of wheels to bottom of vehicle body.
- Add: creates a vehicle of the
Avialable types
- front wheel drive (FWD): basic car
- rear-wheel drive (RWD): basic car, alternate motors.
- motorcycle: two wheel vehicle, front steering, rear motor.
- mecanum: 4 independently motorized mecanum wheels. unique differential steering. can strafe.
- omni: 3 indepdendently motorized wheels. unique differential steering. can strafe.
- tank: 2 indepdendently motorized wheels. unique differential steering.
- 4 wheel chassis: basic car body, wheels, no motor.
Please note
- All dimensions in centimeters, seconds, and kilograms.
- All cars point forward on their X axis and up on their Z axis.
- Unless noted, vehicles cannot strafe.
- Vehicles were introduced in 2.6.4.
- Create an entity called "car". Add a CarComponent to car.
- Create an entity called "mesh" under car. Add a Shape to the body and position it.
- for each wheel,
- create an entity called "suspension" under car.
- create an entity called "wheel" under suspension.
- create an entity called "mesh" under wheel.
- Add a Shape (probably Cylinder) to the wheel mesh and position/rotate it. The mesh will rotate around the Z axis.
- add a WheelComponent to wheel.
- Set the diameter and width of the wheel in WheelComponent.
- Add each wheel to the list of wheels in CarComponent.
Note step 3 can be done once and then copy/pasted to save time.
- For vehicles with one motor, add an entity called "motor" under car and add a DCMotorComponent to motor.
- For vehicles with one motor per wheel, add DCMotorComponent to each wheel entity.
- In each WheelComponent, set the "drive" to the motor entity. This tells the vehicle system which wheel is driven by which motor.
- In each DCMotorComponent, add all the wheel meshes driven by this motor to the list of connections.
You can then select each motor to adjust their RPM/torque curves.
- Add ServoMotorComponent to the suspension of each steer-able wheel.
- In each WheelComponent, set the "steer" to the suspension. This tells the vehicle system which which servo drives this wheel.
- In each ServoMotorComponent, add the wheel entity to the list of connections.
You can then select each servo motor to adjust their RPM/torque curves and PID response.