Making a Car and for some reason when I turn the car using an attachments orientation its goes around a full 360 to get to the steering orientation. I had to add 180 to the steering for the Right Wheel as it would have been in the axle if not and I believe this is whats causing the problem.
Orientation does some funky things whenever your reach their (-180, 180) degree limits, I would recommend setting the attachment’s CFrame instead.
local steerOrientation = self.Steer * -driversSeat.VehicleSeat.SteerFloat
local attachL = axle.PrimaryPart.LeftAttachment
local attachR = axle.PrimaryPart.RightAttachment
-- NOTE: You might need to change which axis the steerOrientation is on
local goalL = {CFrame = CFrame.Angles(0, math.rad(steerOrientation), 0) + attachL.CFrame.Position}
local goalR = {CFrame = CFrame.Angles(0, math.rad(steerOrientation - 180), 0) + attachR.CFrame.Position}
local tweenInfo = TweenInfo.new(0.4, Enum.EasingStyle.Quad, Enum.EasingDirection.InOut)
game.TweenService:Create(attachL, tweenInfo, goalL):Play()
game.TweenService:Create(attachR, tweenInfo, goalR):Play()
Just double checking did you include the position of the CFrame, otherwise the attachment’s position will be affected
-- Do this
CFrame = CFrame.Angles(0, math.rad(steerOrientation), 0) + attach(L/R).CFrame.Position
-- Not this
CFrame = CFrame.Angles(0, math.rad(steerOrientation), 0)
WorldCFrame seems to have fixed the positioning but now when ever the player steers it stops from being lock in by the hinge constraint until the tween finishes.
Believe The Attachment was supposed to also reference the WorldPosition but yes I have change it to use WorldPosition and its worked fine besides the part of it lagging behind
Haha I get the assumption. Just FYI Attachment.CFrame / Attachment.Position is an offset from it’s parent unlike WorldCFrame / WorldPosition. If it’s lagging behind I would still use the CFrame property instead of WorldCFrame.
Tweening steering seems a bit strange. Please explain why you are doing it this way.
I’d just use Motors and set the DesiredAngle of those to whatever it needs to be. The MotorMaxVelocity takes care of the smooth movement. Motor steering suspension car.rbxm (15.9 KB)
Ill have to mess around with the Motor Instance and see what I can come up with thank you for the model I can see something working out with the Rod Constraints.