I’m making a Sonic engine, and I have 2 CFrames that work excellently separately, but start violently fighting and throwing things at each other the second I try and combine them (figurative).
For simplicity, I’m just gonna name these 2 CFrames “Horizontal” and “Vertical”, and the end product will just be called “end product”.
Here’s videos of Horizontal and Vertical on their own.
Horizontal:
Vertical:
Horizontal on its own can only move along the X, and Z axes; like the default Roblox controller. However, Vertical on its own can walk on walls; you can only move forwards though, you can’t turn at all (when grounded).
Combining these two would give the player the ability to walk on walls, AND turn; but every time I try to combine them. This is the outcome:
I’ve tried multiplying Horizontal * Vertical, Vertical * Horizontal, using ToObjectSpace, ToWorldSpace, but nothing works, here’s the logic.
local hitNormal = ray.Normal
local currentRightVector = self.hrp.CFrame.RightVector
local upVector = hitNormal
local newFacialVector = currentRightVector:Cross(upVector)
local Rot = CFrame.fromMatrix(self.hrp.Position, currentRightVector, upVector, newFacialVector) + self.hrp.Position
local Rot2 = self.alignOrientation.CFrame:ToObjectSpace(CFrame.lookAt(self.hrp.Position, self.hrp.Position + Vector3.new(self.move_Direction.Unit.X, 0, self.move_Direction.Unit.Z)))
--rot is Vertical, rot2 is vertical
if self.humanoid.MoveDirection ~= Vector3.new(0, 0, 0) then
self.alignOrientation.CFrame = Rot2 * Rot
end
IVE TRIED EVERYTHING I CANT DO IT I NEED HELP PLEASE HELP ME HELP ME HELP ME HELP ME
Thanks in advance!
