For my vehicle system I want to implement a steering wheel that’d rotate in the same direction as the tires, however I have no idea where to start or what to check for!
There are a couple ways you can do this.
One of the better options would be to use TweenService, although without an implemented system to override Tweens (you can only do that with GUI elements), you might want to use workarounds or a simpler system.
Here’s two ways you can do this in code:
-- tweening
ts:Create(part, TweenInfo.new(2, Enum.EasingStyle.Linear), {CFrame = part.CFrame * CFrame.Angles(0,math.rad(part.CFrame.Rotation.Y + 90), 0)}):Play()
-- (if you want to pause this then declare it as a variable first and then play it)
-- static turning. works easily with variables and more lag-free but not as a smooth result
local CanTurn = true
for i = 1, 30 do
if CanTurn then
part.CFrame *= CFrame.Angles(0,math.rad(90/30),0)
task.wait(0.05)
else
break
end
end
Hope this helps!
I used a hingeconstraint and servo mode and did something like this
hinge.TargetAngle = vehicleseat.Steer*25
can you give more info on that?
basically, I have the steering wheel model which is separate of the cars body, and I have two attachments. one in steering wheel wherever it should turn, and one in the body the same cframe that the steering attachment has. I then make a Hinhge constraint and set the attachments, then I turn it to servo mode, actuator type I think is what it’s called. Then, in the script, I just do what I pasted abov.e
I’m sorry I couldn’t understand, where exactly do you put the attachments?
so the first attachment is right inside the steering wheel model, I can see that the second attachment is somewhere inside the body but where exactly is that? Could you show me a world image of that as well?
The second attachment shouldn’t matter what part it is in the body, aslong as the position and orientation of the second attachment is the same as the first attachment, which yes, is inside a basepart inside the steeringwheel
thank you I’ll try this out
I’ve been searching days for this! it works just as I wanted you’re a lifesaver <3
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.