# A way to calculate RotVelocity with more precision

I am currently working on a vehicle simulator script, and a big part of that script is using the wheel’s rotational velocity to calculate things like engine RPM.

My script is currently buggy as heck because when I pull the wheel’s rotational velocity, if it was moving and then stopped, the script reads the rotational velocity as the last number it was, rather than 0

The script is a normal script stored in a server owned object in the workplace.

I call this block of code periodically to update wheel rotational velocity

``````function updateinputvars()
Throttle = script.Parent.VehicleSeat.Throttle
Steer = script.Parent.VehicleSeat.Steer
Velocity = script.Parent.frame.Velocity
WheelRotVel = RLW.RotVelocity.Magnitude
Occupant = script.Parent.VehicleSeat.Occupant
end
``````

I’m wondering if anyone knows any solutions to accurately pull the rotational velocity every .05 seconds or so

this is a picture of the output window printing the Wheel Rotational Velocity as I goes down to 0. when It hits 0 radians/second, it stops updating it’s rotational velocity

are you out of the vehicle at zero because it could be rendering it similar to a real car where theres still an idle rpm, I know the ss6 chassis does that anyway

huh? no I’m still in the vehicle seat and I’m just pulling the rotational velocity of the right rear wheel and displaying it in output

the ss6 chassis model uses a scripted engine (being a literal one not a game engine) and it has an idle rpm, I believe roblox might have one which might be what you are detecting, the rpm is also x1000 so the output you are receiving x1000 is your rpm, if you want to stop and kill the rpm you could try a while loop
like
while speed == 0 then
rpm = 0
wait()
end
while speed >0 then
rpm = 0
wait()
end

that obviously wouldn’t work but you get the idea

how does that have anything to do with pulling the rotational velocity off of a moving brick?

I’m offering an alternative way, I tried that way a fair while ago, I did offer you a possible solution above but you kinda pushed it aside like it was nothing

and as an edited note both my first response offer possible reasons to why you actually cant get 0 even when the vehicle is stationary and the start of the answer above that offers a possible alternative that would get you what you want