So, say this is my character
and it was positioned on a slope like this
How would I make it so it takes the LowerTorso’s Motor6d called “Root” to face flat with the ground like the player’s feet are stinking to it, here is a picture for example.
So this transfers to this
-vv-vv-
And this one as well
-vv-vv-
So I want it to keep its original Orientation while combining it with the angle of the slope.
I got the CFrames position and rotation to work on a part that doesn’t have a motor connected to it. Here is a video of that
However, when I apply the code to a motor6d on a character It seems to multiply the Y Axis’s rotation by 2
This I part of my code for the the rotation
local groundRay = CreateRay(Root.Position,Root.Position + Root.CFrame.UpVector*-5,Character:GetDescendants(),Enum.RaycastFilterType.Exclude,nil,false)
if groundRay then
local Look = groundRay.Normal:Cross(Root.CFrame.RightVector)
local finalCFrame = CFrame.lookAt(Vector3.zero, Look, groundRay.Normal)
TweenService:Create(Joints.RootJoint.Joint, TweenInfo.new(0.1),{C0 = finalCFrame}):Play()
end
How would I stop the Y axis from being not accurate with where the humanoid root part is facing?