How to make the player tilt in a direction of velocity?

I want to make the player tilt in a direction on a zipline, like the video down below.

How can I achieve this effect, without using anything like AlignOrientation, AlignPosition, etc.?

2 Likes

You can try to use lookvector and make the player act like a magnet to the beizer points kind of like this

How would I exactly do that? I’m not really an expert on velocities and stuff like that.

you can try to use this part of a script I have as an example `local Settings = Zipline.CompileSettings(self.settingsFolder)
local rideTime = (1 / Zipline.Global.LockedFPS) / (self.length / Settings.Speed)

	local BezierPosition = self.curvePoints:CalculatePositionRelativeToLength(curveT)

	local Retry = 0

	while BezierPosition ~= BezierPosition do
		Retry += 0.0000000000000001 
		BezierPosition = self.curvePoints:CalculatePositionRelativeToLength(curveT)
	end

	local NextBezierPosition = self.curvePoints:CalculatePositionRelativeToLength(math.clamp(curveT + rideTime, 0, 1))

	if BezierPosition == NextBezierPosition then 
		NextBezierPosition = previousCF.Rotation
	end

	local RideCFrame = if typeof(NextBezierPosition) == "Vector3" then 
		CFrame.new(BezierPosition, NextBezierPosition) else
		CFrame.new(BezierPosition) * NextBezierPosition
	local lookVectorVal = math.abs(RideCFrame.LookVector.X) > math.abs(RideCFrame.LookVector.Z) and "X" or "Z"
	local oppositeLookVector = lookVectorVal == "X" and "Z" or "X"

	local rotationDirection = if Zipline.Global.Settings.Rotate.Value then (RideCFrame.LookVector[oppositeLookVector] < 0 and -1 or 1) else 0
	local rotationAngle = math.floor((RideCFrame[lookVectorVal .. "Vector"].Z - previousCF[lookVectorVal .. "Vector"].Z) * 400 + 0.5) * 40

	previousCF = RideCFrame
	rotationDegrees += (math.clamp(rotationDirection * rotationAngle, -68, 68) - rotationDegrees) * .04

	HumanoidRootPart.CFrame = RideCFrame * CFrame.Angles(0, 0, math.rad(rotationDegrees)) * CFrame.new(Zipline.Global.Settings.Offset.Value)
	HumanoidRootPart.AssemblyLinearVelocity = Vector3.new()
	HumanoidRootPart.AssemblyAngularVelocity = Vector3.new()
	bodyPos.Position = HumanoidRootPart.Position
	SparklePart.CFrame = RideCFrame

	local timeTaken = tick() - startMovingTime
	local frameDeltaTime = RunService.RenderStepped:Wait()
	local scaledDeltaTime = (timeTaken + frameDeltaTime) / (1 / Zipline.Global.LockedFPS)

	if curveT <= 1 then
		if curveT < 1 then 
			curveT = math.clamp(curveT + rideTime * scaledDeltaTime, 0, 1)
		else
			curveT += rideTime * scaledDeltaTime
		end
	end
	if tick() - startRiding >= .1 and Humanoid.Jump and (typeof(Settings) == "Instance" and ((Settings ~= nil and Settings:FindFirstChild("CanCancel") and Settings:FindFirstChild("CanCancel").Value == true)) or (Character:FindFirstChild("IsTripmineTrouble") and Character:FindFirstChild("IsTripmineTrouble").Value)) then
		CancelRide = true
	end
end`