Hello, If you read the title I want to rotate the local player’s camera while it still posses them. I want to achieve an effect similar to what CameraOffset
does but instead of moving the camera making it rotate. Is this possible because I think I’ve seen games achieve this but I do not know how they did it.
Since Humanoid does not have a “RotationOffset” property, I think the only way to achieve this effect is to create your own camera script and add the ability to add rotation offset in all axes yourself.
Could you explain? The game will take place in first person as well if that also provides information.
Basically, there’s no way to add rotation offset to the camera using roblox’s default camera script. You’d have to create your own Camera script that to add Offset in the rotation of the camera.
One basic way this can be accomplished is with a NumberValue or Number Attribute. Let’s use an object named “CameraRotation”, you can rotate a full 360 degrees around the player like so:
local TS = game:GetService("TweenService") --TweenService
local TI = TweenInfo.new(4) --Rotation Info
local Player = game.Players.LocalPlayer
local CameraRotation = Instance.new("NumberValue")
CameraRotation.Parent = Player.Character.Humanoid
local CameraTween = TS:Create(RotValue, TI, {Value = 360})
local InitialOffset = workspace.Camera.CFrame.Position - Player.Character.Head.Position --Get the current camera offset from the player
RotValue.Changed:Connect(function()
workspace.Camera.CFrame = CFrame.new(Player.Character.Head.Position) *
CFrame.Angles(0, math.rad(RotValue.Value) ,0) * CFrame.new(InitialOffset) --We start at the primarypart of our character, rotate the cframe, and add the initial offset to it
workspace.Camera.CFrame = CFrame.new(workspace.Camera.CFrame.Position, Player.Character.Head.Position) --Finally we change the camera to look at the player, specifically at their head like in the default camera module
end)
CameraTween:Play() --Now we play the tween. Make sure to update InitialOffset whenever starting a new rotation.
With this script it seems as if your revolving the camera around the player and all im trying to do is rotate the camera itself. for example I could rotate the camera so it would be sideways and everything would be sideways.
Sorry for the late response I am a decent scripter not too advanced so are you saying editing robloxs default camera script and attempting the camera rotation property or something like that?