Tweening Orientation Issues (Overachieving/Unnecessary)

I’ve had this issue before, though I’ve never found out how to make tweening still work in the way that I’ve wanted it to in this specific fashion. Here’s what it looks like:

And here’s the orientation value tweening:

Lastly, here’s the script in its current state

DriveSeat:GetPropertyChangedSignal("SteerFloat"):Connect(function()
	TweenService:Create(Tires.FR.Joint.Attachment0, TweenInfo.new(1) -- FR is for the front-right wheel
		,{
			["Orientation"] = Vector3.new(0, math.floor(180 - DriveSeat.SteerFloat * DriveSeat.TurnSpeed), 90)
		}
	):Play()	
	TweenService:Create(Tires.FL.Joint.Attachment0, TweenInfo.new(1) -- FL is for the front-left wheel
		,{
			["Orientation"] = Vector3.new(0, math.floor(-180 - DriveSeat.SteerFloat * DriveSeat.TurnSpeed), 90)
		}
	):Play()
end)

maybe the parts are unanchored ? possibly playing with physics ?

Try tweening the CFrame instead? Tweening the orientation isn’t reliable.

Okay I just used custom linear interpolation to solve this issue. Here’s the solution:

local function Lerp(A, B, C)
	return A + (B - A) * C
end

DriveSeat:GetPropertyChangedSignal("SteerFloat"):Connect(function()
	local FRY = math.floor(180 - DriveSeat.SteerFloat * DriveSeat.TurnSpeed)
	local FLY = math.floor(-180 - DriveSeat.SteerFloat * DriveSeat.TurnSpeed)
	
	print("Front Right: " .. FRY, "Front Left: " .. FLY)
	
	for Increment = 0, 1, 0.05 do task.wait()
		Tires.FR.Joint.Attachment0.Orientation = Vector3.new(0, Lerp(180, FRY, Increment), 90)
		Tires.FL.Joint.Attachment0.Orientation = Vector3.new(0, Lerp(-180, FLY, Increment), 90)
	end
	
--[[
	TweenService:Create(Tires.FR.Joint.Attachment0, TweenInfo.new(1) -- FR is for the front-right wheel
		,{
			["Orientation"] = Vector3.new(0, FRY, 90)
		}
	):Play()	
	TweenService:Create(Tires.FL.Joint.Attachment0, TweenInfo.new(1) -- FL is for the front-left wheel
		,{
			["Orientation"] = Vector3.new(0, FLY, 90)
		}
	):Play()
]]--
end)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.