diff --git a/src/car_physics.cpp b/src/car_physics.cpp new file mode 100644 index 0000000..410c7c0 --- /dev/null +++ b/src/car_physics.cpp @@ -0,0 +1,16 @@ +#include "car_physics.hpp" +namespace godot { +void CarPhysics::_bind_methods() { +#define CLASSNAME CarPhysics +void CarPhysics::_enter_tree() { + this->set_use_custom_integrator(true); +} + +void CarPhysics::_integrate_forces(PhysicsDirectBodyState3D *state) { +} + +const float CarPhysics::ACCELERATION{20.f}; +const float CarPhysics::BRAKE_FORCE{5.f}; +const float CarPhysics::UNDERSTEER_SPEED_MUL{0.f}; +const float CarPhysics::OVERSTEER_SPEED_MUL{0.f}; +} diff --git a/src/car_physics.hpp b/src/car_physics.hpp new file mode 100644 index 0000000..814c54e --- /dev/null +++ b/src/car_physics.hpp @@ -0,0 +1,19 @@ +#ifndef CAR_PHYSICS_HPP +#define CAR_PHYSICS_HPP + +namespace godot { +class CarPhysics : public RigidBody3D { + GDCLASS(CarPhysics, RigidBody3D); + static void _bind_methods(); +public: + virtual void _enter_tree() override; + virtual void _integrate_forces(PhysicsDirectBodyState3D *state) override; +private: + static const float ACCELERATION; + static const float BRAKE_FORCE; + static const float UNDERSTEER_SPEED_MUL; + static const float OVERSTEER_SPEED_MUL; +}; +} + +#endif // !CAR_PHYSICS_HPP