I came into a problem yesterday about these wheels only rotating depending on the world’s rotation. Can anyone please help?
Video :
Code :
if wheel.Name == "FL" then
wheel.Orientation += Vector3.new(0, steerAngle, 0)
end
if wheel.Name == "FR" then
wheel.Orientation += Vector3.new(0, steerAngle, 0)
end
I don’t really wanna add attachments to my wheels or parts. I just need to know how to change the rotation of the front wheels of the car relative to it’s current rotation. Thanks though.
Conveniently, but only this is used for vehicles, mine also use it, and your inning can’t work well. Hingeconstaint does the calculation of rotation of the wheels perfectly.
if wheel.Name == "FL" then
for _, v in pairs(mainPart:GetChildren()) do
if v.Name == wheel.Name then
v.C0 = CFrame.new(v.C0.Position) * CFrame.Angles(0, math.rad(steerAngle), 0)
end
end
end
if wheel.Name == "FR" then
for _, v in pairs(mainPart:GetChildren()) do
if v.Name == wheel.Name then
v.C0 = CFrame.new(v.C0.Position) * CFrame.Angles(0, math.rad(steerAngle), 0)
end
end
end
I don’t know exactly how to do it, but I can look at it late. I used only physics for my cars and the wheels are connected to the hinge and even accordingly it spins. (I don’t mean old cars, they are very similar to raycast cars)
Alright, I fixed it though lol don’t worry. I just used Motor6d’s instead and used a new script.
if wheel.Name == "FL" then
for _, v in pairs(mainPart:GetChildren()) do
if v.Name == wheel.Name then
v.C0 = CFrame.new(v.C0.Position) * CFrame.Angles(0, math.rad(wheelAngle), 0)
end
end
end
if wheel.Name == "FR" then
for _, v in pairs(mainPart:GetChildren()) do
if v.Name == wheel.Name then
v.C0 = CFrame.new(v.C0.Position) * CFrame.Angles(0, math.rad(wheelAngle), 0)
end
end
end