4#include "godot_cpp/classes/collision_shape3d.hpp" 
    5#include "godot_cpp/templates/hash_set.hpp" 
    6#include "godot_cpp/variant/rid.hpp" 
    7#include <godot_cpp/classes/curve.hpp> 
    8#include <godot_cpp/classes/physics_direct_body_state3d.hpp> 
    9#include <godot_cpp/classes/rigid_body3d.hpp> 
   39    void on_body_shape_exited(RID body_rid, Node *node, 
int body_shape_index, 
int local_shape_index);
 
Subclass Sandbox for car physics. Uses _integrate_forces and local_velocity to abstract the behaviour...
Definition car_physics.hpp:13
 
void set_current_steering(float steering)
The current steering input.
Definition car_physics.cpp:204
 
float oversteer_speed_penalty
Definition car_physics.hpp:159
 
float get_understeer_curve_x_scale() const
The amount of speed represented by x=1 on the understeer curve.
Definition car_physics.cpp:248
 
bool brake
While true, the handbrake is on.
Definition car_physics.hpp:146
 
float acceleration
Definition car_physics.hpp:152
 
float get_acceleration() const
The base engine acceleration of this car.
Definition car_physics.cpp:256
 
float get_oversteer_steering_speed() const
Base amount of steering applied while oversteering.
Definition car_physics.cpp:328
 
CollisionShape3D * back_wheels
Definition car_physics.hpp:169
 
void set_acceleration(float value)
The base engine acceleration of this car.
Definition car_physics.cpp:252
 
void set_traction_recovery_speed(float value)
The speed at which the car will return to regular traction after under- or oversteering.
Definition car_physics.cpp:284
 
float get_slide_resistance() const
Deceleration applied to sideways velocity.
Definition car_physics.cpp:336
 
void set_slide_resistance(float value)
Deceleration applied to sideways velocity.
Definition car_physics.cpp:332
 
void set_oversteer_steering_speed(float value)
Modifier applied to brake force when oversteering.
Definition car_physics.cpp:324
 
float target_speed
Target value for local_velocity.z.
Definition car_physics.hpp:142
 
void set_steering_inward_speed(float value)
Target amount of velocity towards the centre of a turn while steering.
Definition car_physics.cpp:340
 
void integrate_steering(PhysicsDirectBodyState3D *state)
Integrate steering into angular and local x velocities. As a side-effect this also applies sliding re...
Definition car_physics.cpp:90
 
void integrate_engine_acceleration(PhysicsDirectBodyState3D *state)
Apply velocity along local z. Accelerates towards value returned by get_true_target_speed at get_curr...
Definition car_physics.cpp:105
 
float steering_inward_speed
Definition car_physics.hpp:164
 
float slide_resistance
Definition car_physics.hpp:163
 
float get_current_acceleration() const
Returns acceleration, taking into account braking, throttle, and handbrake.
Definition car_physics.cpp:160
 
float slide_speed_acceleration
Definition car_physics.hpp:158
 
void process_understeer(double delta_time)
Process the current_understeer member variable.
Definition car_physics.cpp:66
 
float get_target_speed() const
The target speed.
Definition car_physics.cpp:200
 
float get_max_slide_speed() const
The maximum sideways speed that can be reached while drifting.
Definition car_physics.cpp:296
 
float get_engine_brake_force() const
The base engine braking force of this car.
Definition car_physics.cpp:264
 
float handbrake_oversteer
Definition car_physics.hpp:155
 
void set_slide_speed_acceleration(float value)
The sideways acceleration applied when drifting.
Definition car_physics.cpp:300
 
float get_current_speed() const
The current forward velocity (local_velocity.z)
Definition car_physics.cpp:192
 
float get_oversteer_brake_penalty() const
Modifier applied to brake force when oversteering.
Definition car_physics.cpp:320
 
Ref< Curve > oversteer_curve
Definition car_physics.hpp:148
 
float get_traction_recovery_speed() const
The speed at which the car will return to regular traction after under- or oversteering.
Definition car_physics.cpp:288
 
void set_oversteer_speed_penalty(float value)
Deceleration applied to forward speed when oversteering.
Definition car_physics.cpp:308
 
float get_current_steering() const
The current steering input.
Definition car_physics.cpp:208
 
void set_max_slide_speed(float value)
The maximum sideways speed that can be reached while drifting.
Definition car_physics.cpp:292
 
Vector3 world_to_local_velocity() const
transform the current world velocity to local coordinates
Definition car_physics.cpp:182
 
void set_target_speed(float target)
The target speed.
Definition car_physics.cpp:196
 
float get_oversteer_curve_x_scale() const
The amount of speed represented by x=1 on the oversteer curve.
Definition car_physics.cpp:232
 
Ref< Curve > understeer_curve
Definition car_physics.hpp:150
 
void process_oversteer(double delta_time)
Process the current_oversteer member variable.
Definition car_physics.cpp:53
 
Vector3 last_velocity
Acceleration at the end of the integration step of the last frame.
Definition car_physics.hpp:138
 
void integrate_oversteer(PhysicsDirectBodyState3D *state)
Integrate oversteering to local_velocity to allow drifting.
Definition car_physics.cpp:116
 
virtual void _integrate_forces(PhysicsDirectBodyState3D *state) override
Custom force integrator. Split into integrate_steering, integrate_engine_acceleration and integrate_o...
Definition car_physics.cpp:77
 
Vector3 local_velocity
Velocity relative to the local transform.
Definition car_physics.hpp:140
 
float current_understeer
Definition car_physics.hpp:171
 
void set_understeer_curve_x_scale(float scale)
The amount of speed represented by x=1 on the understeer curve.
Definition car_physics.cpp:244
 
float engine_brake_force
Definition car_physics.hpp:153
 
HashSet< Node * > grounded_objects
Definition car_physics.hpp:166
 
float get_handbrake_oversteer() const
The modifier applied to oversteering when the handbrake is active.
Definition car_physics.cpp:280
 
void set_understeer_curve(Ref< Curve > curve)
The base curve used for understeering.
Definition car_physics.cpp:236
 
float get_slide_speed_acceleration() const
The sideways acceleration applied when drifting.
Definition car_physics.cpp:304
 
float traction_recovery_speed
Definition car_physics.hpp:156
 
void set_brake(bool value)
True if the hand-brake is currently active.
Definition car_physics.cpp:212
 
void set_engine_brake_force(float value)
The base engine braking force of this car.
Definition car_physics.cpp:260
 
float get_steering_inward_speed() const
Target amount of velocity towards the centre of a turn while steering.
Definition car_physics.cpp:344
 
float understeer_speed_penalty
Definition car_physics.hpp:162
 
Ref< Curve > get_oversteer_curve() const
The base curve used for oversteering.
Definition car_physics.cpp:224
 
Vector3 get_local_velocity() const
Public getter for current local velocity.
Definition car_physics.cpp:168
 
void set_oversteer_curve(Ref< Curve > curve)
The base curve used for oversteering.
Definition car_physics.cpp:220
 
void set_handbrake_oversteer(float value)
The modifier applied to oversteering when the handbrake is active.
Definition car_physics.cpp:276
 
float get_oversteer_speed_penalty() const
Deceleration applied to forward speed when oversteering.
Definition car_physics.cpp:312
 
float max_slide_speed
Definition car_physics.hpp:157
 
virtual void _enter_tree() override
Enable _integrate_forces, fetch child nodes, and setup contact monitoring.
Definition car_physics.cpp:28
 
float current_steering
Current steering input.
Definition car_physics.hpp:144
 
float oversteer_brake_penalty
Definition car_physics.hpp:160
 
CollisionShape3D * front_wheels
Definition car_physics.hpp:168
 
void set_oversteer_curve_x_scale(float scale)
The amount of speed represented by x=1 on the oversteer curve.
Definition car_physics.cpp:228
 
float understeer_curve_x_scale
Definition car_physics.hpp:151
 
GDCLASS(CarPhysics, RigidBody3D)
 
void on_body_shape_exited(RID body_rid, Node *node, int body_shape_index, int local_shape_index)
Detect that an object lost contact with the wheels.
Definition car_physics.cpp:131
 
Ref< Curve > get_understeer_curve() const
The base curve used for understeering.
Definition car_physics.cpp:240
 
virtual void _physics_process(double delta_time) override
Fixed-interval process function. Split into process_oversteer and process_understeer.
Definition car_physics.cpp:40
 
float handbrake_force
Definition car_physics.hpp:154
 
float get_handbrake_force() const
The amount of braking force applied by the handbrake.
Definition car_physics.cpp:272
 
float evaluate_oversteer_curve(float speed) const
evaluate the oversteer curve with a speed, taking *_x_scale into account
Definition car_physics.cpp:136
 
float evaluate_understeer_curve(float speed) const
evaluate the understeer curve with a speed, taking *_x_scale into account
Definition car_physics.cpp:142
 
float current_oversteer
Definition car_physics.hpp:172
 
bool get_brake() const
True if the hand-brake is currently active.
Definition car_physics.cpp:216
 
void on_body_shape_entered(RID body_rid, Node *node, int body_shape_index, int local_shape_index)
Detect that an object started colliding with the wheels.
Definition car_physics.cpp:121
 
Vector3 local_to_world_velocity() const
transform the current local_velocity to world coordinates
Definition car_physics.cpp:172
 
bool is_grounded() const
Returns true if there is at least one contact with either of the wheels.
Definition car_physics.cpp:156
 
void set_handbrake_force(float value)
The amount of braking force applied by the handbrake.
Definition car_physics.cpp:268
 
float oversteer_steering_speed
Definition car_physics.hpp:161
 
float get_true_target_speed() const
Returns the maximum speed modified by under/oversteer.
Definition car_physics.cpp:148
 
static void _bind_methods()
Registers functions and properties.
Definition car_physics.cpp:8
 
float oversteer_curve_x_scale
Definition car_physics.hpp:149
 
void set_oversteer_brake_penalty(float value)
Modifier applied to brake force when oversteering.
Definition car_physics.cpp:316
 
Definition beacon_powerup.cpp:6