From 39910afa5439d3ed782f41622960b338c0c1e0c8 Mon Sep 17 00:00:00 2001 From: maverickdgg Date: Tue, 1 Nov 2022 15:49:15 +0800 Subject: [PATCH] Added GetForward to Camera C# interface. GetForward gets the forward according to Camera's last calculated view matrix --- SHADE_Managed/src/Components/Camera.cxx | 9 ++++++++- SHADE_Managed/src/Components/Camera.hxx | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/SHADE_Managed/src/Components/Camera.cxx b/SHADE_Managed/src/Components/Camera.cxx index f90e2bfe..5e570cc1 100644 --- a/SHADE_Managed/src/Components/Camera.cxx +++ b/SHADE_Managed/src/Components/Camera.cxx @@ -114,7 +114,14 @@ namespace SHADE system->CameraLookAt(*GetNativeComponent(), Convert::ToNative(targetPosition)); } - + Vector3 Camera::GetForward() + { + auto system = SHSystemManager::GetSystem(); + SHVec3 forward, up, right; + system->GetCameraAxis(*GetNativeComponent(), forward, right, up); + return Convert::ToCLI(forward); + + } } \ No newline at end of file diff --git a/SHADE_Managed/src/Components/Camera.hxx b/SHADE_Managed/src/Components/Camera.hxx index e5a017b3..257bff11 100644 --- a/SHADE_Managed/src/Components/Camera.hxx +++ b/SHADE_Managed/src/Components/Camera.hxx @@ -65,5 +65,6 @@ namespace SHADE void SetMainCamera(size_t directorIndex); void SetMainCamera(); void LookAt(Vector3 targetPosition); + Vector3 GetForward(); }; } \ No newline at end of file