Hey there developers,
I want to force the player’s camera to face a specific point in the world, then hand control back to the player with the camera already oriented toward that point — so it feels like the player naturally rotated their camera there. Every approach I’ve tried either flickers or snaps back to the original orientation the moment I switch back to Enum.CameraType.Custom. How do I set the camera’s starting orientation before returning control to the player?
Please help!
What I want to happen: medal.tv video link
(pretend the camera tweened instead of me dragging it)
I want it to tween to where the camera would be if the player had manually dragged it there, respecting camera zoom out distance or if they’re in first person etc, and then let them control the camera again.
Not sure if I understand what you’re getting at since its a little bit vague, but I’d still like the point out some of the problems in your code. I don’t know if it’ll help or not but these little points where you’re iterating through a loop and using RenderStepped:Wait() is pointless. You can use task.wait() to the same extent if you’re trying to wait.
Better practice would be connecting renderstepped as an actual event, and disconnecting it after you’re done using it. Also, as far as I’m aware, using Enum.CameraType.Custom just sets the camera back to your character unless thats what you want? Again I’m not too sure because of the wording, some screenshots would help.
Edit: Ok I re-read what you asked, if you’re trying to preserve the position of the camera to use after you’re done with your sequence, just store your cameras position in a variable and use it after the sequence is done.
Ok sorry for my bad description but I’ve now edited it to be more understandable now since I made you guys misunderstand me (my apologies). Any solutions?
There is no script, I just really don’t know how to force the player to look at something “naturally” in third person or first person, respecting camera zoom, without any flicking and with it actually working.
Say you have a part of interest which we will call “Interest part”. You want the player to be forced to “naturally” have their camera move to look at the object orbitally around the player.
That’s what I’m trying to do.
I realised the script I posted before was so dysfunctional so I just removed it.
local Camera = workspace.CurrentCamera
local TargetPosition : Vector3 = nil
Camera.CameraType = Enum.CameraType.Scriptable
Camera.CFrame = CFrame.lookAt(Camera.CFrame.Position, TargetPosition)
The problem with this is that the scriptable camera type won’t allow the player to move the camera on their own and changing the camera type back to custom will reset the scripted changes. There is no other way that I’m aware of
I’m surprised there is no such functionality. Recently, I have been feeling like Roblox has been lacking quite a lot of features (there’s not even any Geometry service:SeparateAsync() to separate unions via code!).
I think you can just do this by changing the camera’s rotation. This keeps it at it’s current zoom, and it still orbits around the player, just as if the player moved it.
I’m not sure if you can use tweens, but if you can’t, just use a for loop.
The only problem with this is the player can still move the camera in between each loop iteration, which causes the camera to snap back on the next iteration, so maybe there is a way to disable camera movement, or something like that.
Here’s the test code I wrote if you need:
local camera = workspace.CurrentCamera
for i = 0, 180 do
camera.CFrame = CFrame.new(camera.CFrame.Position) * CFrame.Angles(0, math.rad(i), 0)
task.wait(0.025)
end