How to detecting each time a wheel turns

I’m not really sure where to start so I haven’t done anything but i want to fire an event each quarter of a turn of a wheel so where would i start and how would i even achieve it

2 Likes

Instead of detecting each time a wheel turns, you can find how long it takes for one turn and then do this:

local timeForTurn = ...
while true do
    wait(timeForTurn/4)
    -- Fire your event
end

well id like to detect when the wheel itself turns rather than that way because if the wheel spins but its not actually moving it wont count

That’s true.
…Well, I am not sure right now. If I find out, I’ll post it here.

Continually check whether the rotation property of the wheel has changed from before. Then, if it has, make sure it has done a full rotation by checking the degrees, and then fire the event.

game:GetService("RunService").RenderStepped:Connect(function()
    if -- Rotation has changed blah blah blah
        -- Fire event
    end
end)

What is your method of rotating the wheel?

1 Like

Well if you want to make a turning car, then you could detect when a user pressed A/D, then rotate the wheel based on that, then make the car turn.

This isn’t what OP wanted. They want to know how to check every time the wheel turns 360 degrees.

You could get the wheels neutral “up vector” and get the dot product of the latter with its current “up vector”, and if the difference is 1/4 of a circle, then you made a quarter turn. Here is what I mean:


Once the green line (vector in your case) is 90/180/270 degrees away from the red line, then that’ll be a quarter turn each time.

1 Like

no i didnt @Aspecky has a good idea the wheels turn by hinge constraints and i simply want to fire a function each time they 90,180,270,360 and im not doing this for car steering i dont want to go into detail but i just want to get a simply rotating cylinder to fire a function each time it hits each quarter of a turn

also im confused on how exactly i would do that do you have any references or something?