diff --git a/res/project/res/scenes/MainScene.evsc b/res/project/res/scenes/MainScene.evsc index cff684a..8a708f2 100644 --- a/res/project/res/scenes/MainScene.evsc +++ b/res/project/res/scenes/MainScene.evsc @@ -6,22 +6,59 @@ "components": [ { "type": "TransformComponent", - "position": [0.0, 0.0, 0.0], + "position": [0.0, 0.0, 5.0], "rotation": [0.0, 0.0, 0.0], "scale": [1.0, 1.0, 1.0] }, + { + "type": "ScriptComponent", + "script_name": "MainCameraController", + "script_path": "scripts://MainScene/Camera.lua" + } + ], + "children": [ + { + "id": "RotationHelper", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, 0.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "CameraComponent", + "view": "Perspective", + "fov": 90, + "near": 0.001, + "far": 1000, + "aspectRatio": 1.3333 + }, + { + "type": "ScriptComponent", + "script_name": "MainCameraRotationHelper", + "script_path": "scripts://MainScene/CameraHelper.lua" + } + ] + } + ] + }, + { + "id": "SideCamera", + "components": [ + { + "type": "TransformComponent", + "position": [25.0, 0.0, -15.0], + "rotation": [0.0, 90.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, { "type": "CameraComponent", "view": "Perspective", - "fov": 60, + "fov": 90, "near": 0.001, "far": 1000, "aspectRatio": 1.3333 - }, - { - "type": "ScriptComponent", - "script_name": "MainCameraController", - "script_path": "scripts://MainScene/camera.lua" } ] }, @@ -30,7 +67,7 @@ "components": [ { "type": "TransformComponent", - "position": [0.0, 10.0, -15.0], + "position": [0.0, 0.0, -15.0], "rotation": [0.0, 0.0, 0.0], "scale": [1.0, 1.0, 1.0] }, @@ -47,7 +84,7 @@ { "type": "ScriptComponent", "script_name": "MainPlayerController", - "script_path": "scripts://MainScene/player.lua" + "script_path": "scripts://MainScene/Player.lua" } ], "children": [ @@ -81,33 +118,130 @@ { "type": "ScriptComponent", "script_name": "MainChildController", - "script_path": "scripts://MainScene/child.lua" + "script_path": "scripts://MainScene/Child.lua" } ] } ] }, { - "id": "Ground", + "id": "Map", "components": [ { "type": "TransformComponent", - "position": [0.0, -15.0, -15.0], + "position": [0.0, 0.0, 0.0], "rotation": [0.0, 0.0, 0.0], "scale": [1.0, 1.0, 1.0] + } + ], + "children": [ + { + "id": "Ground", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, -5.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [10.0, 1.0, 10.0] + } + } + ] }, { - "type": "RigidbodyComponent", - "rigidbodyType": "Static", - "mass": 0.0, - "restitution": 0.0, - "collisionShape": { - "type": "Box", - "halfExtents": [10.0, 10.0, 10.0] - } + "id": "Ceiling", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 5.0, -15.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [10.0, 1.0, 10.0] + } + } + ] + }, + { + "id": "WallRight", + "components": [ + { + "type": "TransformComponent", + "position": [9.0, 0.0, -14.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [1.0, 4.0, 9.0] + } + } + ] + }, + { + "id": "WallLeft", + "components": [ + { + "type": "TransformComponent", + "position": [-9.0, 0.0, -14.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [1.0, 4.0, 9.0] + } + } + ] + }, + { + "id": "WallBack", + "components": [ + { + "type": "TransformComponent", + "position": [0.0, 0.0, -24.0], + "rotation": [0.0, 0.0, 0.0], + "scale": [1.0, 1.0, 1.0] + }, + { + "type": "RigidbodyComponent", + "rigidbodyType": "Static", + "mass": 0.0, + "restitution": 0.0, + "collisionShape": { + "type": "Box", + "halfExtents": [10.0, 4.0, 1.0] + } + } + ] } ] } ], - "activeCamera": "Camera" + "activeCamera": "Camera.RotationHelper" } diff --git a/res/project/res/scenes/SideScene.evsc b/res/project/res/scenes/SideScene.evsc index a76faaf..19c7af6 100644 --- a/res/project/res/scenes/SideScene.evsc +++ b/res/project/res/scenes/SideScene.evsc @@ -1,5 +1,5 @@ { - "id":"SisyphusoScene", + "id":"SideScene", "nodes": [ { "id": "Camera", @@ -21,7 +21,7 @@ { "type": "ScriptComponent", "script_name": "SideCameraController", - "script_path": "scripts://SideScene/camera.lua" + "script_path": "scripts://SideScene/Camera.lua" } ] }, @@ -48,7 +48,7 @@ { "type": "ScriptComponent", "script_name": "SidePlayerController", - "script_path": "scripts://SideScene/player.lua" + "script_path": "scripts://SideScene/Player.lua" } ], "children": [ @@ -74,7 +74,7 @@ { "type": "ScriptComponent", "script_name": "SideChildController", - "script_path": "scripts://SideScene/child.lua" + "script_path": "scripts://SideScene/Child.lua" } ] } @@ -102,7 +102,7 @@ { "type": "ScriptComponent", "script_name": "SideGhostController", - "script_path": "scripts://SideScene/ghost.lua" + "script_path": "scripts://SideScene/Ghost.lua" } ] }, diff --git a/res/project/res/scripts/MainScene/camera.lua b/res/project/res/scripts/MainScene/Camera.lua similarity index 90% rename from res/project/res/scripts/MainScene/camera.lua rename to res/project/res/scripts/MainScene/Camera.lua index bff7af0..6a44585 100644 --- a/res/project/res/scripts/MainScene/camera.lua +++ b/res/project/res/scripts/MainScene/Camera.lua @@ -3,12 +3,10 @@ this.on_init = function() this.original_position = this.position this.angles = Vec3:new() this.mouse_sens = 0.01 - Input.lockCursor() end this.on_update = function() local deltaMouseMovement = Input.getDeltaMousePos() - this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens this.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens this.eulerAngles = this.angles end diff --git a/res/project/res/scripts/MainScene/CameraHelper.lua b/res/project/res/scripts/MainScene/CameraHelper.lua new file mode 100644 index 0000000..41266f0 --- /dev/null +++ b/res/project/res/scripts/MainScene/CameraHelper.lua @@ -0,0 +1,10 @@ +this.on_init = function() + this.angles = Vec3:new() + this.mouse_sens = 0.01 +end + +this.on_update = function() + local deltaMouseMovement = Input.getDeltaMousePos() + this.angles.x = this.angles.x - deltaMouseMovement.y * this.mouse_sens + this.eulerAngles = this.angles +end diff --git a/res/project/res/scripts/MainScene/child.lua b/res/project/res/scripts/MainScene/Child.lua similarity index 100% rename from res/project/res/scripts/MainScene/child.lua rename to res/project/res/scripts/MainScene/Child.lua diff --git a/res/project/res/scripts/MainScene/player.lua b/res/project/res/scripts/MainScene/Player.lua similarity index 100% rename from res/project/res/scripts/MainScene/player.lua rename to res/project/res/scripts/MainScene/Player.lua diff --git a/res/project/res/scripts/SideScene/camera.lua b/res/project/res/scripts/SideScene/Camera.lua similarity index 100% rename from res/project/res/scripts/SideScene/camera.lua rename to res/project/res/scripts/SideScene/Camera.lua diff --git a/res/project/res/scripts/SideScene/child.lua b/res/project/res/scripts/SideScene/Child.lua similarity index 100% rename from res/project/res/scripts/SideScene/child.lua rename to res/project/res/scripts/SideScene/Child.lua diff --git a/res/project/res/scripts/SideScene/ghost.lua b/res/project/res/scripts/SideScene/Ghost.lua similarity index 100% rename from res/project/res/scripts/SideScene/ghost.lua rename to res/project/res/scripts/SideScene/Ghost.lua diff --git a/res/project/res/scripts/SideScene/player.lua b/res/project/res/scripts/SideScene/Player.lua similarity index 100% rename from res/project/res/scripts/SideScene/player.lua rename to res/project/res/scripts/SideScene/Player.lua