I have a rolling system in game, and I want it to roll wherever the player is moving. My solution to this is to use HumanoidRootPart.CFrame.LookVector * CFrame.Angles()
However, my question is how would I be able to convert the humanoid’s MoveDirection into a CFrame.Angles for me to use?
I’ve tried just using the movement keys WASD but that doesn’t take mobile players into consideration.
Are you making a movement mechanic similar to Super Monkey Ball?
You’ll want to apply a torque on the ball that’s perpendicular to the desired movement direction. It should also be horizontal, which is equivalent to being perpendicular to the vertical direction. This means you can calculate the axis around which to rotate the ball like so:
local rotateAxis = moveDirection:Cross(Vector3.yAxis).Unit
Given a rotation axis, you can compute the CFrame that represents a rotation about that axis like so:
local rotateCFrame = CFrame.fromAxisAngles(rotateAxis, rotationAmount)
rotationAmount is a number representing how many radians to rotate.
nope, it’s just normal roblox movement, however, upon pressing C, the character will quickly roll/dash in the direction the character is moving in (thats what im going for at least)