Getting Position Left or Right Depending where player is looking

Hello, i am currently working at my rock module, and trying to do some sort of walking effect.
I need to calculate the Position of the Right/Left side of the player

Here is what i mean by the that:

image
image

As you can see on screenshots, it should also be depending on where player is looking.
I tried adding something like + Vector3.new(2,0,0) but it doesnt work like i want.

Yeah thats all, please help :smiley:

2 Likes

if I got this post correct using CFrames would be your best option.

just get the HumanoidRootParts CFrame like so:

local hrpCFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame 

then just do this:

local hrpCFrame = game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame 

local leftCFrame = hrpCFrame * CFrame.new(-2, 0, 0)
local rightCFrame = hrpCFrame * CFrame.new(2, 0, 0)

since this wasn’t the first solution that came to your mind I would recommend looking at roblox’s documentation on CFrames and also some posts by people on the devForum.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.