How to determine the rotation speed of VehicleWheel node?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By socterean

Hello everyone!

I want to get the rotation speed (RPM) of the Vehicle Wheel node for one of my projects. But I couldn’t find any good information on how I can achieve that.

To be more specific, I have a car and I want to see how fast a given wheel is rotating when I am driving around.

Thank you!

:bust_in_silhouette: Reply From: ZBot

What type of Node is the Wheel? If it is a RigidBody. You can use:

get_angular_velocity() 

to access the rotation speed and

set_angular_velocity(value) to change it

Thank you for your answer, unfortunately the node is an actual VehicleWheel node and I think that it does not have access to the RigidBody member functions as I can see from the documentation, I was hoping to find some indirect way to determine or simulate the rotation speed. But now if I think about it I believe that I can calculate the supposed rotation from the actual speed of the car in relation with the wheel’s radius.

Here is the VehicleWheel node that I am talking about, and I don’t believe it is actually rotating, just simulates the rotation: VehicleWheel — Godot Engine (3.0) documentation in English

socterean | 2018-08-08 13:10

I see, unfortunately i have never used Vehiclewheel node so can’t help you there at the moment. I may look into it some time in the future, though I can’t make any promises.

ZBot | 2018-08-09 14:40

:bust_in_silhouette: Reply From: socterean

I have found the solution and I will let it here for the people who might need it. As I have found out I think that the Vehicle Wheel Node doesn’t actually rotate, but the supposed RPM that it should have can still be calculated as follows:

revolutions per minute (RPM) = speed in meters per minute / circumference of the wheel in meters

and

circumference of the wheel = radius * PI (aprox 3.14) * 2