I need help with being able to tell whether an object is tilted to the left or to the right relative to another object

Suppose u have 1 CFrame. Let this be the original CFrame with 0,0,0.

We have a part that is facing the same CFrame as the original default CFrame of the world.

We roll this part to the side such that the top is facing to the left maybe lets say 25 degrees.

We want to compare the UpVector of the 2 CFrames to get an angle

it’s complicated

	
function a.IsTilted(part, relativeto)	

	local cf = CFrame.new( (part.CFrame * CFrame.new(0, 10, 0)).Position )	
	local cf2 = CFrame.new(part.Position) --  please replace part.Position with relativeto
	
	local x =  cf:ToObjectSpace(cf2).X/10
	if math.abs(x) > .65 then
			
	else
		x = 0
	end
	return x
end

It’s for my game Downhill Rush idk if you’ve played it but this is going to make the game controls smoother since the game will involve going on inclined slopes.

The angle is math.acos(UpVec1:Dot(UpVec2)) in radians.
The direction is a little more complicated, but if you only care about left or right, you can check whether UpVecObjectSpace.X is positive or negative.

what is upvec2? what is upvec1 ???

You tell me

UpVecObjectSpace is is CF1:ToObjectSpace(CF2).UpVector