From f567fb8ee94a9a44a17d2377b0d4a03401e78649 Mon Sep 17 00:00:00 2001 From: OusmBlueNinja <89956790+OusmBlueNinja@users.noreply.github.com> Date: Thu, 2 Jan 2025 22:16:50 -0600 Subject: [PATCH] Updated Camera Script --- Makefile | 2 +- assets/scripts/camera.lua | 18 +++++++++++++++--- imgui.ini | 22 ++++++++++------------ scenes/Default.scene | 12 ++++++------ 4 files changed, 32 insertions(+), 22 deletions(-) diff --git a/Makefile b/Makefile index 5aefad3..552a058 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ $(TARGET): $(OBJ_FILES) # Pattern rule to compile .cpp files to .o files # Note the mkdir on the $(dir $@) ensures subfolders under build/ exist. $(BUILD_DIR)/%.o: %.cpp - @mkdir "$(dir $@)" >nul 2>&1 || echo Directory exists + @mkdir "$(dir $@)" >nul 2>&1 @echo Compiling $<... $(CXX) $(CXXFLAGS) -c $< -o $@ diff --git a/assets/scripts/camera.lua b/assets/scripts/camera.lua index 0bd1791..6998862 100644 --- a/assets/scripts/camera.lua +++ b/assets/scripts/camera.lua @@ -6,8 +6,8 @@ local transform = nil local new_rotation = 0 -local new_rotationSpeed = 15 -local Move_Speec = 300 +local new_rotationSpeed = 120 +local Move_Speec = 600 function OnInit() local gameObject = Engine.GetGameObjectByTag("Camera") @@ -43,6 +43,10 @@ function OnUpdate(deltaTime) transform:SetPosition(Position) Engine.Expose("Position X", Position.x) + Engine.Expose("Position Y", Position.y) + Engine.Expose("Rotation", new_rotation) + + @@ -53,7 +57,15 @@ function OnUpdate(deltaTime) } -- Apply the new new_rotation to the Transform component transform:SetRotation(rotation) - new_rotation = new_rotation + (deltaTime * new_rotationSpeed) + + if Engine.KeyDown(KeyCode.Q) then + new_rotation = new_rotation - (deltaTime * new_rotationSpeed) + + end + if Engine.KeyDown(KeyCode.E) then + new_rotation = new_rotation + (deltaTime * new_rotationSpeed) + + end if new_rotation >= 360 then new_rotation = 0 end diff --git a/imgui.ini b/imgui.ini index 2fc750c..271a1ba 100644 --- a/imgui.ini +++ b/imgui.ini @@ -95,7 +95,7 @@ DockId=0x00000019,0 Pos=8,27 Size=322,732 Collapsed=0 -DockId=0x00000023,0 +DockId=0x0000001B,0 [Window][Scene Window@SceneWindow] Pos=8,27 @@ -107,7 +107,7 @@ DockId=0x0000000F,0 Pos=8,28 Size=335,672 Collapsed=0 -DockId=0x00000023,0 +DockId=0x0000001B,0 [Window][Game Objects] Pos=182,27 @@ -152,10 +152,10 @@ Collapsed=0 DockId=0x00000022,0 [Window][ Profiler] -Pos=-344,52 -Size=335,199 +Pos=345,28 +Size=1189,816 Collapsed=0 -DockId=0x00000024,0 +DockId=0x0000001F,1 [Table][0xE9E836E4,4] Column 0 Weight=1.2999 @@ -164,18 +164,16 @@ Column 2 Weight=0.6474 Column 3 Weight=1.0088 [Table][0x08173DEA,4] -Column 0 Weight=1.4321 -Column 1 Weight=0.8821 -Column 2 Weight=0.9929 -Column 3 Weight=0.6929 +Column 0 Weight=1.4299 +Column 1 Weight=0.9086 +Column 2 Weight=0.9665 +Column 3 Weight=0.6950 [Docking][Data] DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,51 Size=1904,1141 Split=X Selected=0xF7365A5A DockNode ID=0x00000020 Parent=0x14621557 SizeRef=886,684 Split=X DockNode ID=0x00000013 Parent=0x00000020 SizeRef=335,1142 Split=Y Selected=0x818D04BB - DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,672 Split=Y Selected=0x1D5D92B6 - DockNode ID=0x00000023 Parent=0x0000001B SizeRef=335,337 HiddenTabBar=1 Selected=0x1D5D92B6 - DockNode ID=0x00000024 Parent=0x0000001B SizeRef=335,333 Selected=0x7A66B86B + DockNode ID=0x0000001B Parent=0x00000013 SizeRef=264,672 HiddenTabBar=1 Selected=0x1D5D92B6 DockNode ID=0x0000001C Parent=0x00000013 SizeRef=264,467 HiddenTabBar=1 Selected=0x818D04BB DockNode ID=0x00000014 Parent=0x00000020 SizeRef=1567,1142 Split=X DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1158,1142 Split=X diff --git a/scenes/Default.scene b/scenes/Default.scene index a8feabd..99df807 100644 --- a/scenes/Default.scene +++ b/scenes/Default.scene @@ -167,12 +167,12 @@ Entities: IsPerspective: true DefaultRuntimeCamera: true FOV: 45 - AspectRatio: 1 + AspectRatio: 1.75 NearPlane: 0.100000001 FarPlane: 7000 - ScriptComponent: - ScriptPath: assets/scripts/camera.lua Transform: - Position: [0, 200, 0] - Rotation: [0, 267.034973, 0] - Scale: [1, 1, 1] \ No newline at end of file + Position: [-130.615494, 200, -13.0714865] + Rotation: [0, -360.790955, 0] + Scale: [1, 1, 1] + ScriptComponent: + ScriptPath: assets/scripts/camera.lua \ No newline at end of file