Played around with MainScene to test hot-reloading
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -3,6 +3,22 @@
|
|||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"id": "Camera",
|
"id": "Camera",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"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": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "TransformComponent",
|
"type": "TransformComponent",
|
||||||
@@ -13,15 +29,36 @@
|
|||||||
{
|
{
|
||||||
"type": "CameraComponent",
|
"type": "CameraComponent",
|
||||||
"view": "Perspective",
|
"view": "Perspective",
|
||||||
"fov": 60,
|
"fov": 90,
|
||||||
"near": 0.001,
|
"near": 0.001,
|
||||||
"far": 1000,
|
"far": 1000,
|
||||||
"aspectRatio": 1.3333
|
"aspectRatio": 1.3333
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "MainCameraController",
|
"script_name": "MainCameraRotationHelper",
|
||||||
"script_path": "scripts://MainScene/camera.lua"
|
"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": 90,
|
||||||
|
"near": 0.001,
|
||||||
|
"far": 1000,
|
||||||
|
"aspectRatio": 1.3333
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -30,7 +67,7 @@
|
|||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "TransformComponent",
|
"type": "TransformComponent",
|
||||||
"position": [0.0, 10.0, -15.0],
|
"position": [0.0, 0.0, -15.0],
|
||||||
"rotation": [0.0, 0.0, 0.0],
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
"scale": [1.0, 1.0, 1.0]
|
"scale": [1.0, 1.0, 1.0]
|
||||||
},
|
},
|
||||||
@@ -47,7 +84,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "MainPlayerController",
|
"script_name": "MainPlayerController",
|
||||||
"script_path": "scripts://MainScene/player.lua"
|
"script_path": "scripts://MainScene/Player.lua"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"children": [
|
"children": [
|
||||||
@@ -81,18 +118,29 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "MainChildController",
|
"script_name": "MainChildController",
|
||||||
"script_path": "scripts://MainScene/child.lua"
|
"script_path": "scripts://MainScene/Child.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "Map",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"position": [0.0, 0.0, 0.0],
|
||||||
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
|
"scale": [1.0, 1.0, 1.0]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
{
|
{
|
||||||
"id": "Ground",
|
"id": "Ground",
|
||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "TransformComponent",
|
"type": "TransformComponent",
|
||||||
"position": [0.0, -15.0, -15.0],
|
"position": [0.0, -5.0, -15.0],
|
||||||
"rotation": [0.0, 0.0, 0.0],
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
"scale": [1.0, 1.0, 1.0]
|
"scale": [1.0, 1.0, 1.0]
|
||||||
},
|
},
|
||||||
@@ -103,11 +151,97 @@
|
|||||||
"restitution": 0.0,
|
"restitution": 0.0,
|
||||||
"collisionShape": {
|
"collisionShape": {
|
||||||
"type": "Box",
|
"type": "Box",
|
||||||
"halfExtents": [10.0, 10.0, 10.0]
|
"halfExtents": [10.0, 1.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"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"id":"SisyphusoScene",
|
"id":"SideScene",
|
||||||
"nodes": [
|
"nodes": [
|
||||||
{
|
{
|
||||||
"id": "Camera",
|
"id": "Camera",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "SideCameraController",
|
"script_name": "SideCameraController",
|
||||||
"script_path": "scripts://SideScene/camera.lua"
|
"script_path": "scripts://SideScene/Camera.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -48,7 +48,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "SidePlayerController",
|
"script_name": "SidePlayerController",
|
||||||
"script_path": "scripts://SideScene/player.lua"
|
"script_path": "scripts://SideScene/Player.lua"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"children": [
|
"children": [
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "SideChildController",
|
"script_name": "SideChildController",
|
||||||
"script_path": "scripts://SideScene/child.lua"
|
"script_path": "scripts://SideScene/Child.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@
|
|||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "SideGhostController",
|
"script_name": "SideGhostController",
|
||||||
"script_path": "scripts://SideScene/ghost.lua"
|
"script_path": "scripts://SideScene/Ghost.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,12 +3,10 @@ this.on_init = function()
|
|||||||
this.original_position = this.position
|
this.original_position = this.position
|
||||||
this.angles = Vec3:new()
|
this.angles = Vec3:new()
|
||||||
this.mouse_sens = 0.01
|
this.mouse_sens = 0.01
|
||||||
Input.lockCursor()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
this.on_update = function()
|
this.on_update = function()
|
||||||
local deltaMouseMovement = Input.getDeltaMousePos()
|
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.angles.y = this.angles.y - deltaMouseMovement.x * this.mouse_sens
|
||||||
this.eulerAngles = this.angles
|
this.eulerAngles = this.angles
|
||||||
end
|
end
|
||||||
10
res/project/res/scripts/MainScene/CameraHelper.lua
Normal file
10
res/project/res/scripts/MainScene/CameraHelper.lua
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user