diff --git a/rwengine/include/objects/VehicleObject.hpp b/rwengine/include/objects/VehicleObject.hpp index 87975d22..3727db8d 100644 --- a/rwengine/include/objects/VehicleObject.hpp +++ b/rwengine/include/objects/VehicleObject.hpp @@ -81,6 +81,8 @@ public: void tickPhysics(float dt); bool isFlipped() const; + + float getVelocity() const; void ejectAll(); diff --git a/rwengine/src/objects/VehicleObject.cpp b/rwengine/src/objects/VehicleObject.cpp index ebc4df8e..98e964aa 100644 --- a/rwengine/src/objects/VehicleObject.cpp +++ b/rwengine/src/objects/VehicleObject.cpp @@ -365,6 +365,14 @@ bool VehicleObject::isFlipped() const return up.z <= -0.1f; } +float VehicleObject::getVelocity() const +{ + if (physVehicle) { + return (physVehicle->getCurrentSpeedKmHour()*1000.f)/(60.f*60.f); + } + return 0.f; +} + void VehicleObject::setSteeringAngle(float a) { steerAngle = a; diff --git a/rwgame/ingamestate.cpp b/rwgame/ingamestate.cpp index d3c6865d..cb0c41fc 100644 --- a/rwgame/ingamestate.cpp +++ b/rwgame/ingamestate.cpp @@ -15,11 +15,19 @@ #include