https://gyazo.com/9a90564bd9738e69475f9697ff416137
At first I thought the issue was the motor6d that I create for the glider, but then I removed the remote event that clones the glider and adds the motor6d and I still am facing the same problem. I am pretty sure that its got something to do with not properly resetting the C1 of the character, but I did some testing and the C1 Offset remains the same! I will link a video of what I am saying below.
https://gyazo.com/03363f281d1a118ed7991b72eb427170
I also heard that this might be an issue caused by physics constraints, but the only constraints I use are LinearVelocity and AlignOrientation and I make sure to remove them on unequip.
Below i have pasted all the functions where I edit the Character:
function Glider:BodyMovers()
--//Instancing
local LinearVelocity = Instance.new("LinearVelocity")
local AlignOrientation = Instance.new("AlignOrientation")
--//Config
LinearVelocity.MaxForce = 5000
LinearVelocity.Attachment0 = HumanoidRootPart.RootRigAttachment
LinearVelocity.Name = "GliderMover"
LinearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
AlignOrientation.MaxTorque = 50000
AlignOrientation.Attachment0 = HumanoidRootPart.RootRigAttachment
AlignOrientation.Mode = Enum.OrientationAlignmentMode.OneAttachment
AlignOrientation.Name = "GliderMover"
AlignOrientation.Responsiveness = 200
--//Setting Parent
LinearVelocity.Parent = Character
AlignOrientation.Parent = Character
table.insert(self.Constraints, LinearVelocity)
table.insert(self.Constraints, AlignOrientation)
self.CurrentVelocity = LinearVelocity
self.CurrentOrientation = AlignOrientation
self.Object:InAirUpdate()
end
function Glider:InAirUpdate()
local PitchThreshold = math.rad(45)
local MaxPitch = 15
local Connection = RunService.RenderStepped:Connect(function(deltatime)
local lookVector = camera.CFrame.LookVector
--//Angle of Attack Update
local pitchAngle = math.asin(lookVector.Y)
if math.abs(pitchAngle) < PitchThreshold then
Pitch = math.min(MaxPitch, Pitch + 0.6)
lerpFactorPitch = 0.01
else
lerpFactorPitch = 0.05
TargetPitch = 0
end
--//Directional Update
--//Raycast Update
local distancetoGround = self.Object:DistanceCheck()
local direction = lookVector * Vector3.new(1,0,1)
local multiplier = direction * self.Speed
local movement = multiplier + Vector3.new(0,-5,0)
self.CurrentVelocity.VectorVelocity = movement
local cameraYaw = CFrame.new(camera.CFrame.Position, camera.CFrame.Position + Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z))
-- Apply the yaw-only CFrame to AlignOrientation, as well as angle of attack
self.CurrentOrientation.CFrame = cameraYaw
end)
table.insert(self.OpenConnections, Connection)
end
function Glider:Unequip()
--//Renabling the Animation script
isGliding = false
PlayGlideAnim:Stop()
local AnimateScript = Character:FindFirstChild("Animate")
if AnimateScript then
AnimateScript.Enabled = true
end
--//Check for the glider motor just in case
local motor = Character.Head:FindFirstChild("GliderMotor")
if motor then
motor:Destroy()
end
--//Transform Reset
local LowerTorso = Character:FindFirstChild("LowerTorso")
if LowerTorso then
LowerTorso.Root.C0 = CFrame.new()
LowerTorso.Root.C1 = CFrame.new()
end
local HumanoidRootPart = Character:WaitForChild("HumanoidRootPart")
HumanoidRootPart.CFrame = CFrame.new(HumanoidRootPart.Position)
--//Cleanup
self.Object:Cleanup()
self.Object:Disconnect()
end
function Glider:Tilt()
local idleThreshold = 0.1
local TargetTilt = 0
local MaxTilt = 35
local Tilt = 0
local Connection = RunService.RenderStepped:Connect(function(deltaTime)
if isGliding then
local isMouseMoving = lastmouseDelta > idleThreshold
if not isMouseMoving then
lastmouseDelta = math.max(0, lastmouseDelta - deltaTime * 5)
end
if isMouseMoving then
local Delta = UserInputService:GetMouseDelta()
local Value = math.sign(Delta.X)
lastmouseDelta = math.abs(Delta.X)
if math.abs(Delta.X) > math.abs(Delta.Y) then
if Value > 0 then
Tilt = math.max(-MaxTilt, Tilt - 0.6)
else
Tilt = math.min(MaxTilt, Tilt + 0.6)
end
end
else
TargetTilt = 0
end
local lerpFactorTilt = 0.05
if isMouseMoving then
lerpFactorTilt = 0.01
end
Tilt = Tilt + (TargetTilt - Tilt) * lerpFactorTilt
Pitch = Pitch + (TargetPitch - Pitch) * lerpFactorPitch
Character.LowerTorso.Root.C0 = CFrame.Angles(0, 0, math.rad(Tilt)) * CFrame.Angles(math.rad(-Pitch),0,0)
end
end)
table.insert(self.OpenConnections, Connection)
end
anyways, those are the ones. I did not include the server side part as that is for attaching the glider model and I have tested without it and the issue still persists. Any help is much appreciated, I feel like the solution is super easy.