From da24bc8f3fa5bb00deb7042b63794f4218dee774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 21 May 2016 11:52:21 +0200 Subject: [PATCH] VehicleBody: Cosmetic fixes to previous commit --- doc/base/classes.xml | 15 ++++++--------- scene/3d/vehicle_body.cpp | 2 +- scene/3d/vehicle_body.h | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/doc/base/classes.xml b/doc/base/classes.xml index 64d4100ced4..81adb78e53d 100644 --- a/doc/base/classes.xml +++ b/doc/base/classes.xml @@ -41505,16 +41505,13 @@ This method controls whether the position between two cached points is interpola - Returns the vehicle body speed or velocity in a 3D vector, to get the speed in scalar value - get the length of the return vector, the scalar value is in Godot units/seconds, if you - assume 1.0 is a meter, then it is in meters/sec - Example: - # vehicle is an instance of VehicleBody, 1.0 asumed as 1 meter: - var speed_ms = vehicle.get_linear_velocity().length() - # Lets convert it to Km/h: - var speed_kms = speed_ms * 3.6 + Returns the VehicleBody's velocity vector. To get the absolute speed in scalar value, get the length of the return vector in pixels/second. Example: + [codeblock] + # vehicle is an instance of VehicleBody + var speed = vehicle.get_linear_velocity().length() + [/codeblock] - + diff --git a/scene/3d/vehicle_body.cpp b/scene/3d/vehicle_body.cpp index 6eadc71d63d..e35ba11e849 100644 --- a/scene/3d/vehicle_body.cpp +++ b/scene/3d/vehicle_body.cpp @@ -992,7 +992,7 @@ float VehicleBody::get_steering() const{ Vector3 VehicleBody::get_linear_velocity() { - return linear_velocity; + return linear_velocity; } void VehicleBody::_bind_methods(){ diff --git a/scene/3d/vehicle_body.h b/scene/3d/vehicle_body.h index a026a10dff3..b6ad88f15eb 100644 --- a/scene/3d/vehicle_body.h +++ b/scene/3d/vehicle_body.h @@ -177,7 +177,7 @@ public: void set_steering(float p_steering); float get_steering() const; - + Vector3 get_linear_velocity(); VehicleBody();