I’m trying to make a 45 degrees Camera for my game I want to make the game have levels so each level has its own camera that DOSENT follow the player so each level you pass the game changes the camera
Or if you can just tell me how to make a camera that follows the player but it’s a 45 degrees camera
Thank you (:
Make a part, facing in the direction you want your camera to face, and parent it to the Workspace. Make sure it’s anchored, CanCollide is false, and it’s Transparency is 1
In a LocalScript, inside of StarterGui, do this:
local camera = workspace:WaitForChild("Camera")
local part = workspace:WaitForChild("Part") -- or the name you gave to that part
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = part.CFrame
This is a very basic script, let me know if you have any more questions.
Thank you I will try that soon
Square triangles add up to 180 = 90 + 45 + 45 degrees. We can use this to determine the distances, and then use the CFrame look at function to push the angles for us.
local Player = game.Players.LocalPlayer
local Camera = game.Workspace.CurrentCamera
Camera.CameraType = Enum.CameraType.Scriptable
local CAMERA_DISTANCE = 5
local function isAlive(Player)
-- Function to check if our player is dead/alive
local char = Player.Character
if not char or not char:IsDescendantOf(game.Workspace) or not char:FindFirstChild "Humanoid" or char.Humanoid:GetState() == Enum.HumanoidStateType.Dead then
return
end
return true
end
game:GetService('RunService').RenderStepped:connect(function (delta)
if isAlive(Player) then
local Character = Player.Character
-- If you look at the picture I posted, it'll show that x/y is equidistance, thus both distances are equal...
-- Then we can make the camera look at the head via CFrame.new(Offset, Head Position)
Camera.CFrame = CFrame.new(CFrame.new(Character.Head.Position) * CFrame.new(0, CAMERA_DISTANCE, CAMERA_DISTANCE)).p, Character.Head.Position)
end
end)
Player.CharacterAdded:connect(function ()
-- Reset the camera to scriptable with each new character (as this resets on death)
Camera.CameraType = Enum.CameraType.Scriptable
end)
p.s. you didn’t state in what world axis you wanted the perspective from, so I set it to worldspace axis. You can change this as you desire. Similarly, change the CAMERA_DISTANCE variable to whatever distance you wish.
Yes thanks I will try both of the ways to see witch one works better also what if I want the camera to change position on touch of a block?
So by that, you mean change its perspective in a rotational sense? If you note, I mentioned I told you that I set it as the worldspace axis. So, when a touched event occurs, change the axis of the offset from y, z to x, y etc, or use CFrame.Angles(x, y, z) to change the rotation.
I meant like the camera changing from one level to another dosent matter witch way sideways or any direction
I’m not entirely sure what you mean by that? You’ll need to include a graphic to explain it, or describe it a little more
Ok I’ll send some kind of explanation as soon as possible