-
I try to make a Raycast from the current Viewpoint, the Camera, against a Plane (Plane class). At this moment im going to use a reference throu properties, but i wonder if there is another way. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
You can access it from the GraphicsCompositor. The only hiccup I found is that the camera doesnt populate here until a few frames in and will be null until initialized.
the world position can then be accessed with the entity world matrix |
Beta Was this translation helpful? Give feedback.
-
Holy cow thats cool. |
Beta Was this translation helpful? Give feedback.
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…