I am making a slide system that makes the character parallel to the ground. I have made it to where it does make the character parallel to the ground, but there is an issue with how align orietation works with the attachment I set to its “attachment0”. Whenever I enable it, the character aligns with the ground, but the issue is where the character is facing. Even when I set the attachment to the humanoid root parts look vector, the character orients to a direction that is not where the character is facing…I assume the issue is that the orientation of an attachment works a lot differently than parts. So my question is, how do i can get an attachment that is a parent of an align orientation object, to consistently have the same orientation of the humanoid root part?
Video of the issue.
local rayCastPartClone = rayCastPart:Clone()
local params = RaycastParams.new()
params.FilterDescendantsInstances = {rayCastPartClone, character}
params.FilterType = Enum.RaycastFilterType.Exclude
rayCastPartClone.Parent = workspace
for start = 1, 14 do
--vectorForce.Force = Vector3.new(0,0,startForce)
rayCastPartClone.Position = (HRP.Position + HRP.CFrame.LookVector * 5) + Vector3.new(0,-2,0)
rayCastPartClone.Size = Vector3.new(0.5,0.5,0.5)
local slideRaycast = workspace:Raycast(rayCastPartClone.Position, -rayCastPartClone.CFrame.UpVector * 25, params)
print(slideRaycast)
if humanoid.FloorMaterial == Enum.Material.Air then
alignOrientation.Enabled = false
HRP.AssemblyLinearVelocity = HRP.CFrame.LookVector * 50
rayCastPartClone:Destroy()
break
elseif slideRaycast ~= nil then
--rayCastPartClone.Position = slideRaycast.Position
alignOrientation.Enabled = true
local groundNormal = slideRaycast.Normal
local currCFrame = HRP.CFrame:ToObjectSpace(HRP.CFrame) * CFrame.lookAt(Vector3.zero, slideRaycast.Position + groundNormal)
alignmentAttachment.WorldCFrame = currCFrame
end