DI-Guy SDK Documentation  13.6
diguyVehicleController.h
Go to the documentation of this file.
1 
2 /*********************************************************************
3  ** Copyright (c) 1992-2022 MAK Technologies, Inc.
4  ** All rights reserved.
5  *********************************************************************/
6 
7 /*********************************************************************
8  **
9  *t diguyVehicleController
10  **
11  */
12 
13 #ifndef __diguyVehicleController_H
14 #define __diguyVehicleController_H
15 
16 #ifdef SWIG
18 #else
19 #define CPLUSPLUS_ONLY
20 #endif
21 
22 #ifdef CPLUSPLUS_ONLY
23 
24 #include <declspec_diguy.h>
25 #include <diguy_constants.h>
26 
27 class diguyCharacter;
28 class bdiScenarioVehicleController;
29 
30 #endif
31 
49 /****************************************************************************/
50 class BDI_DECLSPEC_diguy diguyVehicleController
51 {
52 
53 public:
54 
55 /*****************************************************************************
56  **
57  *2 Character Functions
58  **
59  */
60  diguyCharacter* get_vehicle_character();
61 
62 
63 /*****************************************************************************
64  **
65  *2 Speed Functions
66  **
67  ** These functions should only be used in free action mode.
68  **
69  */
70 
71  /*l
72  *b Description:
73  **
74  ** This function sets the vehicle's speed. The speed becomes
75  ** effective immediately; no acceleration or deceleration is applied.
76  **
77  *b Arguments:
78  **
79  *a speed - new speed of vehicle
80  *a units - units of speed
81  **
82  *b Callable From:
83  **
84  *- - C++
85  *- - Script
86  */
87  void set_speed(float speed,
89 
90  /*l
91  ** Returns vehicle's current speed. See set_speed().
92  */
94 
95  /*l
96  ** Vehicle's speed will increase or decrease over time to match the desired speed.
97  ** If necessary, the acceleration value will be applied as deceleration instead.
98  */
99  void set_desired_speed_with_acceleration(float desired_speed,
100  float acceleration,
102 
103  /*l
104  ** An acceleration value is calculated from the time interval and the difference
105  ** between current speed and desired speed.
106  */
107  void set_desired_speed_with_acceleration_time(float desired_speed,
108  float acceleration_time, // seconds
110 
111  /*l
112  ** Returns the desired speed, as currently set.
113  */
114  float get_desired_speed(diguySpeedUnits units = DIGUY_SPEED_UNITS_METERS_PER_SECOND);
115 
116  /*l
117  ** Sets the default acceleration value that will be used whenever the vehicle needs to raise
118  ** its speed.
119  */
120  void set_default_acceleration(float acceleration,
122  float get_default_acceleration(diguySpeedUnits units = DIGUY_SPEED_UNITS_METERS_PER_SECOND);
123 
124  /*l
125  ** Sets the default deceleration value that will be used whenever the vehicle needs to lower
126  ** its speed.
127  */
128  void set_default_deceleration(float deceleration,
130  float get_default_deceleration(diguySpeedUnits units = DIGUY_SPEED_UNITS_METERS_PER_SECOND);
131 
132 
133 /*****************************************************************************
134  **
135  *2 Steering Functions
136  **
137  ** These functions should only be used in free action mode.
138  **
139  */
140 
141  /*l
142  ** Sets the simulation mode, which corresponds, roughly, to the degree of realism
143  ** of the vehicle's movements.
144  **
145  *b Values:
146  **
147  *- - DIGUY_VEHICLE_SIMULATION_MODE_NONE: the vehicle behaves simply as a moving box,
148  *- with no wheel rotation or turning, or steering. The vehicle simply pivots around
149  *- its origin.
150  *- - DIGUY_VEHICLE_SIMULATION_MODE_WHEELS: like NONE, but the wheels rotate.
151  *- - DIGUY_VEHICLE_SIMULATION_MODE_REAR_AXLE_FOLLOWING: like WHEELS, but the turning is
152  *- more realistic. The front wheels turn in their wells, and the pivot axis is what
153  *- it would be in a real car. The vehicle will try to only perform turns that fit
154  *- its steering limits; thus, it might go through a series of turns to round a tight
155  *- corner or to turn around.
156  *- - DIGUY_VEHICLE_SIMULATION_MODE_STEERING: only applies in I-Guy mode, in Scenario.
157  *- Allows the user to be given direct control over the vehicle.
158  *- - DIGUY_VEHICLE_SIMULATION_MODE_FULL_PHYSICS: causes control of the vehicle to be
159  *- taken over by the physics module. This mode is only useful for rigid body simulation
160  *- purposes, such as when a vehicle is thrown through the air by an explosion, not
161  *- for control of normal vehicle movements. All the modes above have some degree of
162  *- "physics", in the sense that DI-Guy makes an effort to keep the wheels on the
163  *- terrain.
164  */
165  void set_vehicle_simulation_mode(diguyVehicleSimulationMode vsim_mode);
166 
168  diguyVehicleSimulationMode get_vehicle_simulation_mode();
169 
170  /*l
171  ** Only works in DIGUY_VEHICLE_SIMULATION_MODE_STEERING. Sets the steering angle of the front
172  ** wheels, with zero being straight ahead.
173  */
174  void set_front_wheels_steer_angle(float angle);
175 
176  /*l
177  ** See set_front_wheels_steer_angle()
178  */
179  float get_front_wheels_steer_angle();
180 
181  /*l
182  ** Similar to set_desired_front_wheels_steer_angle(), but sets the angle that the wheels will
183  ** eventually move to, at the rate specified.
184  */
185  void set_desired_front_wheels_steer_angle(float desired_angle,
186  float angle_change_rate = DIGUY_DEFAULT_FLOAT);
187 
188  /*l
189  ** See set_desired_front_wheels_steer_angle()
190  */
191  float get_desired_front_wheels_steer_angle();
192 
193 
198 #ifdef CPLUSPLUS_ONLY
199 
200  bdiScenarioVehicleController* get_scripted_object() {return m_scripted_object;}
201 
202 private:
203 
204  /*l
205  ** A private constructor.
206  */
207  diguyVehicleController(bdiScenarioVehicleController* vehicle_controller);
209  /*l
210  ** A pointer to internal data.
211  */
212  bdiScenarioVehicleController* m_scripted_object;
213 
214  friend class bdiScenarioVehicleController;
215 
216 #endif
217 
218 };
219 
220 #endif /* __diguyVehicleController_H */
221 
222 
#define DIGUY_DEFAULT_FLOAT
This value is a magic number that, when passed to certain functions, means that the function should u...
Definition: diguy_constants.h:62
Definition: diguy_constants.h:1723
diguySpeedUnits
This enumeration lists units of speed that can be passed to some DI-Guy API functions.
Definition: diguy_constants.h:1721
Attached to certain types of more complex vehicles, to manage their behavior.
Definition: diguyVehicleController.h:49
The class that represents a DI-Guy Entity in the world.
Definition: diguyCharacter.h:82
diguyVehicleSimulationMode
This enumeration lists the modes that the DI-Guy vehicle simulator can be in.
Definition: diguy_constants.h:1800