Skip to content

How do i get the current Cameras position? #1936

Answered by Doprez
MCVenor asked this question in Newcomers
Discussion options

You must be logged in to vote

When it comes to finding the camera with the main tag it would have to be from the GraphicsCompositor.
scriptComponent.SceneSystem.GraphicsCompositor.Cameras;
The GraphicsCompositor contains the CameraSlots that you would assign on the Camera itself with the Slot property. This is why I am looking for the sceneCamera.Name == "Main".

if you wanted to just find the camera in the current scene then you could do a search for an Entity with a specific name using SceneSystem, below would be the LINQ version.
SceneSystem.SceneInstance.RootScene.Entities.Where(x => x.Name == "NameOfCameraEntity");

it does feel funky but this is essentially the same idea as Unity's Camera.Main for the initial code…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@MCVenor
Comment options

Comment options

You must be logged in to vote
3 replies
@Doprez
Comment options

Answer selected by MCVenor
@MCVenor
Comment options

@Ethereal77
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants