Updated res project
Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
@@ -19,7 +19,11 @@
|
|||||||
{
|
{
|
||||||
"id": "MainScene",
|
"id": "MainScene",
|
||||||
"path": "scenes://MainScene.evsc"
|
"path": "scenes://MainScene.evsc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "SideScene",
|
||||||
|
"path": "scenes://SideScene.evsc"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"activeScene": "MainScene"
|
"activeScene": "SideScene"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "CameraController",
|
"script_name": "MainCameraController",
|
||||||
"script_path": "scripts://Scene0/camera.lua"
|
"script_path": "scripts://MainScene/camera.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -30,7 +30,7 @@
|
|||||||
"components": [
|
"components": [
|
||||||
{
|
{
|
||||||
"type": "TransformComponent",
|
"type": "TransformComponent",
|
||||||
"position": [0.0, 0.0, -15.0],
|
"position": [0.0, 10.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]
|
||||||
},
|
},
|
||||||
@@ -46,8 +46,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "PlayerController",
|
"script_name": "MainPlayerController",
|
||||||
"script_path": "scripts://Scene0/player.lua"
|
"script_path": "scripts://MainScene/player.lua"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"children": [
|
"children": [
|
||||||
@@ -66,14 +66,22 @@
|
|||||||
"mass": 1.0,
|
"mass": 1.0,
|
||||||
"restitution": 1.0,
|
"restitution": 1.0,
|
||||||
"collisionShape": {
|
"collisionShape": {
|
||||||
"type": "Sphere",
|
"type": "Box",
|
||||||
"radius": 1.0
|
"halfExtents": [1.0, 1.0, 1.0]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "CameraComponent",
|
||||||
|
"view": "Perspective",
|
||||||
|
"fov": 120,
|
||||||
|
"near": 0.001,
|
||||||
|
"far": 1000,
|
||||||
|
"aspectRatio": 1.3333
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "ScriptComponent",
|
"type": "ScriptComponent",
|
||||||
"script_name": "ChildController",
|
"script_name": "MainChildController",
|
||||||
"script_path": "scripts://Scene0/child.lua"
|
"script_path": "scripts://MainScene/child.lua"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -94,11 +102,12 @@
|
|||||||
"mass": 0.0,
|
"mass": 0.0,
|
||||||
"restitution": 0.0,
|
"restitution": 0.0,
|
||||||
"collisionShape": {
|
"collisionShape": {
|
||||||
"type": "Sphere",
|
"type": "Box",
|
||||||
"radius": 10.0
|
"halfExtents": [10.0, 10.0, 10.0]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"activeCamera": "Camera"
|
||||||
}
|
}
|
||||||
|
|||||||
105
res/project/res/scenes/SideScene.evsc
Normal file
105
res/project/res/scenes/SideScene.evsc
Normal file
@@ -0,0 +1,105 @@
|
|||||||
|
{
|
||||||
|
"id":"SisyphusoScene",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"id": "Camera",
|
||||||
|
"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": 60,
|
||||||
|
"near": 0.001,
|
||||||
|
"far": 1000,
|
||||||
|
"aspectRatio": 1.3333
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ScriptComponent",
|
||||||
|
"script_name": "SideCameraController",
|
||||||
|
"script_path": "scripts://SideScene/camera.lua"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Player",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"position": [0.0, 0.0, -15.0],
|
||||||
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
|
"scale": [1.0, 1.0, 1.0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "RigidbodyComponent",
|
||||||
|
"rigidbodyType": "Dynamic",
|
||||||
|
"mass": 1.0,
|
||||||
|
"restitution": 1.0,
|
||||||
|
"collisionShape": {
|
||||||
|
"type": "Sphere",
|
||||||
|
"radius": 1.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ScriptComponent",
|
||||||
|
"script_name": "SidePlayerController",
|
||||||
|
"script_path": "scripts://SideScene/player.lua"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"id": "Child",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"position": [0.0, 5.0, -5.0],
|
||||||
|
"rotation": [0.0, 0.0, 0.0],
|
||||||
|
"scale": [1.0, 1.0, 1.0]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "RigidbodyComponent",
|
||||||
|
"rigidbodyType": "Kinematic",
|
||||||
|
"mass": 1.0,
|
||||||
|
"restitution": 1.0,
|
||||||
|
"collisionShape": {
|
||||||
|
"type": "Sphere",
|
||||||
|
"radius": 1.0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "ScriptComponent",
|
||||||
|
"script_name": "SideChildController",
|
||||||
|
"script_path": "scripts://SideScene/child.lua"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "Ground",
|
||||||
|
"components": [
|
||||||
|
{
|
||||||
|
"type": "TransformComponent",
|
||||||
|
"position": [0.0, -15.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": "Sphere",
|
||||||
|
"radius": 10.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"activeCamera": "Camera"
|
||||||
|
}
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
this.on_init = function()
|
this.on_init = function()
|
||||||
this.speed = 0.1
|
this.speed = 0.1
|
||||||
|
this.original_position = this.position
|
||||||
end
|
end
|
||||||
|
|
||||||
this.on_fixedupdate = function()
|
this.on_fixedupdate = function()
|
||||||
|
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
|
||||||
|
gotoScene('SideScene')
|
||||||
|
end
|
||||||
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Up) then
|
if Input.getKeyDown(Input.KeyCode.Up) then
|
||||||
this.position = this.position + Vec3:new(0, 1, 0) * this.speed
|
this.position = this.position + Vec3:new(0, 1, 0) * this.speed
|
||||||
end
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
this.on_collisionenter = function(other)
|
-- this.on_collisionenter = function(other)
|
||||||
-- other.position = other.position + Vec3:new(3.2, 0, 0)
|
-- other.position = other.position + Vec3:new(3.2, 0, 0)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
this.on_update = function ()
|
this.on_update = function ()
|
||||||
rb = this:getComponent(Rigidbody)
|
rb = this:getComponent(Rigidbody)
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
this.on_init = function ()
|
|
||||||
this.custom_eulerangles = Vec3:new()
|
|
||||||
this.custom_angularvelocity = Vec3:new(0, 0.01, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
this.on_update = function ()
|
|
||||||
rb = this:getComponent(Rigidbody)
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Enter) then
|
|
||||||
rb:addForce(Vec3:new(0, 100, 0))
|
|
||||||
end
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Right) then
|
|
||||||
rb:addForce(Vec3:new(10, 0, 0))
|
|
||||||
end
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Left) then
|
|
||||||
rb:addForce(Vec3:new(-10, 0, 0))
|
|
||||||
end
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Up) then
|
|
||||||
rb:addForce(Vec3:new(0, 0, -10))
|
|
||||||
end
|
|
||||||
if Input.getKeyDown(Input.KeyCode.Down) then
|
|
||||||
rb:addForce(Vec3:new(0, 0, 10))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
23
res/project/res/scripts/SideScene/camera.lua
Normal file
23
res/project/res/scripts/SideScene/camera.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
this.on_init = function()
|
||||||
|
this.speed = 0.1
|
||||||
|
this.original_position = this.position
|
||||||
|
end
|
||||||
|
|
||||||
|
this.on_fixedupdate = function()
|
||||||
|
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
|
||||||
|
gotoScene('MainScene')
|
||||||
|
end
|
||||||
|
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Up) then
|
||||||
|
this.position = this.position + Vec3:new(0, 1, 0) * this.speed
|
||||||
|
end
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Down) then
|
||||||
|
this.position = this.position - Vec3:new(0, 1, 0) * this.speed
|
||||||
|
end
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Right) then
|
||||||
|
this.position = this.position + Vec3:new(1, 0, 0) * this.speed
|
||||||
|
end
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Left) then
|
||||||
|
this.position = this.position - Vec3:new(1, 0, 0) * this.speed
|
||||||
|
end
|
||||||
|
end
|
||||||
14
res/project/res/scripts/SideScene/child.lua
Normal file
14
res/project/res/scripts/SideScene/child.lua
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
this.on_init = function ()
|
||||||
|
this.custom_eulerangles = Vec3:new()
|
||||||
|
this.custom_angularvelocity = Vec3:new(0, 0.01, 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
this.on_fixedupdate = function ()
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Left) then
|
||||||
|
this.custom_eulerangles:add(Vec3:new(0,0.01,0))
|
||||||
|
end
|
||||||
|
if Input.getKeyDown(Input.KeyCode.Right) then
|
||||||
|
this.custom_eulerangles:sub(Vec3:new(0,0.01,0))
|
||||||
|
end
|
||||||
|
this.eulerAngles = this.custom_eulerangles
|
||||||
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
this.on_collisionenter = function(other)
|
-- this.on_collisionenter = function(other)
|
||||||
other.position = other.position + Vec3:new(0.2, 0, 0)
|
-- other.position = other.position + Vec3:new(3.2, 0, 0)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
this.on_update = function ()
|
this.on_update = function ()
|
||||||
rb = this:getComponent(Rigidbody)
|
rb = this:getComponent(Rigidbody)
|
||||||
Reference in New Issue
Block a user