0 votes

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!

asked Aug 7 in Engine by socterean (21 points)
edited Aug 7 by socterean

2 Answers

0 votes
Best answer

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

answered Aug 9 by socterean (21 points)
+1 vote

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

answered Aug 8 by ZBot (64 points)

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: https://godot.readthedocs.io/en/3.0/classes/class_vehiclewheel.html?highlight=vehicle%20wheel

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.