I wanna make a camera system where when your camera is offset from your character then your character will face the direction your mouse is pointed at ignoring any objects in the way just the direction that your cursor is facing
2 Likes
You have not specified what your itensions are. Are you wanting to know how to make this or are you seeking help and advise?
Please clarify…
You can use Mouse.Hit.p property to find out the position of the cursor, then use a BodyGyro maybe and make the player face that position using CFrame on RenderStepped in a local script. Take a look at this.
1 Like
I actually tried that method, but it doesn’t seem to be working. This is my code:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local pp = char:WaitForChild("HumanoidRootPart")
local gyro = Instance.new("BodyGyro")
local mouse = plr:GetMouse()
gyro.Parent = pp
game:GetService("RunService").RenderStepped:Connect(function()
gyro.CFrame = CFrame.new(pp.Position, Vector3.new(mouse.Hit.p.X, pp.Position.Y, mouse.Hit.p.Z))
end)
Did I write something wrong or is the script just incorrect?
P.S. I put this into a LocalScript first inside StarterCharacterScripts, then inside StarterPlayerScripts, both not giving me any result.
gyro.MaxTorque = Vector3.new(0, 20000, 0)
try adding this
1 Like