You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want to make the players camera.CFrame lock to a parts “Bottom” side
What is the issue? When locking the camera.CFrame to the parts CFrame it is locked to the “Front” face
What solutions have you tried so far? I have tried rotating the Camera by subtracting and adding CFrames. I’ve also searched for solutions on the devforum but found nothing
This is the current LocalScript:
local cam = game.Workspace.CurrentCamera
local defaultcam = cam.CameraType
cam.CameraType = Enum.CameraType.Scriptable
task.spawn(function() --since i need the script to continue while this plays
repeat
cam.CFrame = CameraPart.CFrame * CFrame.new(Vector3.new(0,0,0), Vector3.new(0,-90,0)):Inverse() --Since "cam.CFrame = CameraPart.CFrame" I have tried adding/subtracting CFrames to the original CFrame
task.wait()
until false --This will be a variable check later on
end)
Instead of using task.spawn() you could use RunService.RenderStepped on client.
Then, get the CFrame of the part and from CFrame * CFrame (0, -5, 0), then you could change the point where camera is looking to target the part
Like camera.CFrame = CFrame.lookAt(cameraPosition, partCFrame.Position)
Many details depends on your goal, do you need a scriptable camera that follow the player and keep target on the bottom of the part? or static? like camera subject?
Perhaps you could give more details on your goal
I have an animation which moves a part so i set the camera cframe to that parts cframe. I mean i could just redo the animation and rotate it so that the “front” face is facing the way that i want the camera to face instead of the “Bottom” face but i was looking for if there was another way to fix it
I kinda understand, but, as I said before, why subtracting the CFrame on Y its not working for you? that would always aim the bottom of the part, you could try to base it on its size too
local cam = game.Workspace.CurrentCamera
local defaultcam = cam.CameraType
cam.CameraType = Enum.CameraType.Scriptable
game:GetService("RunService").RenderStepped:Connect(function()
local targetBottom = CameraPart.CFrame * CFrame.new(0, -(CameraPart.Size.Y/2), 0)
cam.CFrame = CFrame.lookAt(cam.Position, targetBottom.Position) -- this is positioning the camera at its current position each iteration and targeting the bottom of the part, change it as you need
end)
CFrame.lookAt(camera.CFrame.Position, -camera.CFrame.UpVector * offset, Vector3.new(0, 1, 0))
This should do the trick. Just set the offset to whatever you want (or 1 if you don’t want offset)