Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to move diagonally with BodyVelocity * Camera LookVector/RightVector?

I'm making a game where you are a ball that can move. (Like Super Blocky Ball without the player inside of the ball) I can't figure out how to move it diagonally. I am using UiService.InputBegan to find out which keys the player is pressing. I'm making the ball move by which combination of keys they are pressing like... (AWD) is forward, (WSD) is right, (AD) is nothing and (A) is left... (Hope you understand...) This is how I am moving it.

local speed = 10

BodyVelocity.Velocity = Vector3.new(speed, 0, speed) * Camera.CFrame.LookVector

If you want me to post my hole script, tell me in the comments!

4 comments

0

Is the camera already offsetted from the ball?

0

Is the camera already offsetted from the ball?

0

ops. sorry if there is 2

0

Kinda? I made the ball become the CameraSubject. (I have a game where it is offsetted, but I'm trying to make it so the camera works like a player camera)

1 answer

I found out how to do it! You just have to add up the lookVector and the rightVector

if A and S then
	BodyVelocity.Velocity = (camera.CFrame.RightVector*-speed)+(camera.CFrame.LookVector*-speed)
end

This discussion is preserved as it was. New answers, comments, and votes are closed.