How to make angularVelocity relative to camera

This is the current script that i have

script.Parent.Humanoid:ChangeState(Enum.HumanoidStateType.Physics)

local uis = game:GetService("UserInputService")
local ball = script.Parent:WaitForChild("PlayerSphere")
while true do
	wait(0.1)
	if uis:IsKeyDown(Enum.KeyCode.W) then

			ball.AssemblyAngularVelocity = Vector3.new(-5 , ball.AssemblyAngularVelocity.Y , ball.AssemblyAngularVelocity.Z)

	elseif uis:IsKeyDown(Enum.KeyCode.A) then

			ball.AssemblyAngularVelocity = Vector3.new(ball.AssemblyAngularVelocity.X , ball.AssemblyAngularVelocity.Y , 5)


	elseif uis:IsKeyDown(Enum.KeyCode.D) then

			ball.AssemblyAngularVelocity = Vector3.new(ball.AssemblyAngularVelocity.X , ball.AssemblyAngularVelocity.Y , -5)


	elseif uis:IsKeyDown(Enum.KeyCode.S) then

			ball.AssemblyAngularVelocity = Vector3.new(5 , ball.AssemblyAngularVelocity.Y , ball.AssemblyAngularVelocity.Z)

	end
end

How can I make the changes in velocity relative to the camera.

Use the balls CFrame.LookVector to move it forward use negative the balls CFrame.LookVector to move it back (-CFrame.LookVector) use CFrame.RightVector to move it right and use -CFrame.RightVector to move it left. This will only work if the ball not actually rolling and is anchored. So if you have a texture on it that you need to see rolling then instead create a small part, put it in the middle of the ball and use a constraint to hold the ball to the part and use the same thiing I said previosuly but only apply it to the part.

Oop forgot to say it’s the player’s character i was going to place this image

I don’t think I can rely on Up/Look/Right Vectors for situations like when the camere points to the front, so I wanted to see if I could bse the movement from the direction of the camera top to bottom
For example:
In this image, the objective left is at the bottom and the right at the top

Can’t you use the character’s humanoid’s MoveDirection?

1 Like

Didn’t know that was a thing, but will check

Whats the players character? The thing that rotates?; If so, are they able to press say W and D at the same time to move diagnol?

Yes but since the angular velocity is objective and not relative the controls become akward whenever the camera changes position

Instead of using angular velocity maybe try using CFrames?

It’s a physics based game, the ball is supposed to roll

CFrame is Positional and rotational.

Yes but the ball won’t roll if I just change it’s CFrame.
My problem is not with the physics, just with getting the amounts to be relative to the camera

What do you mean relative to the camera? Are you using inputs or just the camera?

You know how when you turn the camera when playing a game and press W your character moves forward relative to you?
I have the input part down but i’m having trouble with the camera.