Updated Camera Script
This commit is contained in:
parent
4a64ec69e2
commit
f567fb8ee9
2
Makefile
2
Makefile
@ -63,7 +63,7 @@ $(TARGET): $(OBJ_FILES)
|
|||||||
# Pattern rule to compile .cpp files to .o files
|
# Pattern rule to compile .cpp files to .o files
|
||||||
# Note the mkdir on the $(dir $@) ensures subfolders under build/ exist.
|
# Note the mkdir on the $(dir $@) ensures subfolders under build/ exist.
|
||||||
$(BUILD_DIR)/%.o: %.cpp
|
$(BUILD_DIR)/%.o: %.cpp
|
||||||
@mkdir "$(dir $@)" >nul 2>&1 || echo Directory exists
|
@mkdir "$(dir $@)" >nul 2>&1
|
||||||
@echo Compiling $<...
|
@echo Compiling $<...
|
||||||
$(CXX) $(CXXFLAGS) -c $< -o $@
|
$(CXX) $(CXXFLAGS) -c $< -o $@
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ local transform = nil
|
|||||||
|
|
||||||
local new_rotation = 0
|
local new_rotation = 0
|
||||||
|
|
||||||
local new_rotationSpeed = 15
|
local new_rotationSpeed = 120
|
||||||
local Move_Speec = 300
|
local Move_Speec = 600
|
||||||
|
|
||||||
function OnInit()
|
function OnInit()
|
||||||
local gameObject = Engine.GetGameObjectByTag("Camera")
|
local gameObject = Engine.GetGameObjectByTag("Camera")
|
||||||
@ -43,6 +43,10 @@ function OnUpdate(deltaTime)
|
|||||||
transform:SetPosition(Position)
|
transform:SetPosition(Position)
|
||||||
|
|
||||||
Engine.Expose("Position X", Position.x)
|
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
|
-- Apply the new new_rotation to the Transform component
|
||||||
transform:SetRotation(rotation)
|
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
|
if new_rotation >= 360 then
|
||||||
new_rotation = 0
|
new_rotation = 0
|
||||||
end
|
end
|
||||||
|
22
imgui.ini
22
imgui.ini
@ -95,7 +95,7 @@ DockId=0x00000019,0
|
|||||||
Pos=8,27
|
Pos=8,27
|
||||||
Size=322,732
|
Size=322,732
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000023,0
|
DockId=0x0000001B,0
|
||||||
|
|
||||||
[Window][Scene Window@SceneWindow]
|
[Window][Scene Window@SceneWindow]
|
||||||
Pos=8,27
|
Pos=8,27
|
||||||
@ -107,7 +107,7 @@ DockId=0x0000000F,0
|
|||||||
Pos=8,28
|
Pos=8,28
|
||||||
Size=335,672
|
Size=335,672
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000023,0
|
DockId=0x0000001B,0
|
||||||
|
|
||||||
[Window][Game Objects]
|
[Window][Game Objects]
|
||||||
Pos=182,27
|
Pos=182,27
|
||||||
@ -152,10 +152,10 @@ Collapsed=0
|
|||||||
DockId=0x00000022,0
|
DockId=0x00000022,0
|
||||||
|
|
||||||
[Window][ Profiler]
|
[Window][ Profiler]
|
||||||
Pos=-344,52
|
Pos=345,28
|
||||||
Size=335,199
|
Size=1189,816
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000024,0
|
DockId=0x0000001F,1
|
||||||
|
|
||||||
[Table][0xE9E836E4,4]
|
[Table][0xE9E836E4,4]
|
||||||
Column 0 Weight=1.2999
|
Column 0 Weight=1.2999
|
||||||
@ -164,18 +164,16 @@ Column 2 Weight=0.6474
|
|||||||
Column 3 Weight=1.0088
|
Column 3 Weight=1.0088
|
||||||
|
|
||||||
[Table][0x08173DEA,4]
|
[Table][0x08173DEA,4]
|
||||||
Column 0 Weight=1.4321
|
Column 0 Weight=1.4299
|
||||||
Column 1 Weight=0.8821
|
Column 1 Weight=0.9086
|
||||||
Column 2 Weight=0.9929
|
Column 2 Weight=0.9665
|
||||||
Column 3 Weight=0.6929
|
Column 3 Weight=0.6950
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0x14621557 Window=0x3DA2F1DE Pos=8,51 Size=1904,1141 Split=X Selected=0xF7365A5A
|
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=0x00000020 Parent=0x14621557 SizeRef=886,684 Split=X
|
||||||
DockNode ID=0x00000013 Parent=0x00000020 SizeRef=335,1142 Split=Y Selected=0x818D04BB
|
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=0x0000001B Parent=0x00000013 SizeRef=264,672 HiddenTabBar=1 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=0x0000001C Parent=0x00000013 SizeRef=264,467 HiddenTabBar=1 Selected=0x818D04BB
|
DockNode ID=0x0000001C Parent=0x00000013 SizeRef=264,467 HiddenTabBar=1 Selected=0x818D04BB
|
||||||
DockNode ID=0x00000014 Parent=0x00000020 SizeRef=1567,1142 Split=X
|
DockNode ID=0x00000014 Parent=0x00000020 SizeRef=1567,1142 Split=X
|
||||||
DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1158,1142 Split=X
|
DockNode ID=0x00000015 Parent=0x00000014 SizeRef=1158,1142 Split=X
|
||||||
|
@ -167,12 +167,12 @@ Entities:
|
|||||||
IsPerspective: true
|
IsPerspective: true
|
||||||
DefaultRuntimeCamera: true
|
DefaultRuntimeCamera: true
|
||||||
FOV: 45
|
FOV: 45
|
||||||
AspectRatio: 1
|
AspectRatio: 1.75
|
||||||
NearPlane: 0.100000001
|
NearPlane: 0.100000001
|
||||||
FarPlane: 7000
|
FarPlane: 7000
|
||||||
ScriptComponent:
|
|
||||||
ScriptPath: assets/scripts/camera.lua
|
|
||||||
Transform:
|
Transform:
|
||||||
Position: [0, 200, 0]
|
Position: [-130.615494, 200, -13.0714865]
|
||||||
Rotation: [0, 267.034973, 0]
|
Rotation: [0, -360.790955, 0]
|
||||||
Scale: [1, 1, 1]
|
Scale: [1, 1, 1]
|
||||||
|
ScriptComponent:
|
||||||
|
ScriptPath: assets/scripts/camera.lua
|
Loading…
Reference in New Issue
Block a user