-
What do you want to achieve? Keep it simple and clear!
I’ve gotten quite far with my raycast vehicle, but I’m having problems rotating the welds on my wheels. When I use the wheel steering or rotate wheels by themselves, they rotate in the direction I expect. -
What is the issue? Include screenshots / videos if possible!
When both are used at the same time, though, the rotation is thrown off.
I have my wheel steering and wheel rotate code below.
--Wheel Steering
if string.find(wheelName,"F") then
car[wheelName].Tire.Weld.C0 = car[wheelName].Tire.Weld.C0 * CFrame.fromAxisAngle(Vector3.new(0, 1, 0), math.rad(SmoothSteer * LimitSteering))
end
--Rotate wheels
wheelRotations[car] += LocalVelocity.Z/60
local Rz = wheelRotations[car]
car[wheelName].Tire.Weld.C0 = car[wheelName].Tire.Weld.C0 * CFrame.Angles(0,0,math.rad(Rz))
The wheel steering is applied first.
https://giphy.com/gifs/LyYnnLWgmbhBS6C61M
Rotating the wheels (without steering)
https://giphy.com/gifs/IWy0pOVnXiYDt3EyOZ
Both applied together
https://giphy.com/gifs/GOR0cuwiP2xHKg6Yq8
As seen above this is not the expected behavior. I’m not looking for you to code it for me (what is shown is brief) just an explanation or pseudocode that would help me solve this.