Vehicles: entities of the class vehicle (a jeep, a truck), driven by the player. An actor (a model with a rigid skeleton, see jo_3d_model_draw_pose()): the bones of the wheels turn, the bones of the front wheels and of the steering wheel steer. A simple physics: the speed (engine, brakes, drag), the steering (the turn radius comes from the wheelbase), the 4 wheels on the ground (the height, the pitch and the roll of the body follow the ground under them, with a little suspension), the collisions (the ground says where it can't go, the solid entities stop it: a hit at speed damages them).
More...
Go to the source code of this file.
|
| struct | jo_vehicle |
| | Data of a vehicle (the data of the class vehicle: an actor first). More...
|
Vehicles: entities of the class vehicle (a jeep, a truck), driven by the player. An actor (a model with a rigid skeleton, see jo_3d_model_draw_pose()): the bones of the wheels turn, the bones of the front wheels and of the steering wheel steer. A simple physics: the speed (engine, brakes, drag), the steering (the turn radius comes from the wheelbase), the 4 wheels on the ground (the height, the pitch and the roll of the body follow the ground under them, with a little suspension), the collisions (the ground says where it can't go, the solid entities stop it: a hit at speed damages them).
- Author
- Johannes Fetz
◆ jo_vehicle
Data of a vehicle (the data of the class vehicle: an actor first).
| Data Fields |
|
int |
acceleration |
|
|
jo_actor |
actor |
|
|
int |
braking |
|
|
jo_3d_model * |
cockpit |
|
|
bool |
driven |
|
|
bool |
hit |
|
|
int |
impact |
|
|
jo_fixed |
lift |
|
|
jo_fixed |
lift_speed |
|
|
int |
max_speed |
|
|
int |
max_steer |
|
|
int |
pitch |
|
|
int |
roll |
|
|
jo_fixed |
speed |
|
|
int |
steer |
|
|
short |
steer_bones[2] |
|
|
short |
steering_bone |
|
|
short |
steering_tilt |
|
|
short |
steering_tilt_bone |
|
|
int |
track |
|
|
int |
wheel_angle |
|
|
short |
wheel_bones[4] |
|
|
int |
wheel_radius |
|
|
int |
wheelbase |
|
◆ jo_vehicle_ground_callback
Height of the ground for the vehicles (given by the game).
- Parameters
-
| x | Point (world space) |
| z | Point |
| height | Height of the ground (world units, Y up: the opposite of the Saturn Y), output |
- Returns
- false if a vehicle can't go there (deep water, a wall)
◆ jo_vehicle_drive()
| void jo_vehicle_drive |
( |
jo_entity *const | entity, |
|
|
const int | throttle, |
|
|
const int | steering, |
|
|
const bool | brake, |
|
|
const int | elapsed ) |
Drive a vehicle (each frame while the player is in it).
- Parameters
-
| entity | Entity of the class vehicle |
| throttle | -256 (backward) to 256 (forward), 0: the engine is idle (it slows down) |
| steering | -256 (left) to 256 (right) |
| brake | The brakes |
| elapsed | Milliseconds |
◆ jo_vehicle_get()
Get the vehicle data of an entity.
- Parameters
-
- Returns
- Its data, JO_NULL if it is not a vehicle
◆ jo_vehicle_to_world()
A point of the vehicle in the world (the seat of the driver, the door...).
- Parameters
-
| entity | Entity of the class vehicle |
| local | Point in the space of the model (Saturn axes: Y down, the vehicle looks toward +Z) |
| world | Point in the world (output): turned by the yaw, the pitch and the roll of the vehicle |
◆ jo_vehicles_set_ground_callback()
Give the ground to the vehicles.
- Parameters
-
| callback | Ground (JO_NULL: flat ground at 0, everywhere) |