Updated test scene and testing shader compilation

Signed-off-by: Robear Selwans <robear.selwans@outlook.com>
This commit is contained in:
2021-06-08 09:53:35 +02:00
parent d380e23675
commit 39f6cb87f2
9 changed files with 86 additions and 17 deletions

View File

@@ -25,5 +25,5 @@
"path": "scenes://SideScene.evsc"
}
],
"activeScene": "SideScene"
"activeScene": "MainScene"
}

View File

@@ -13,7 +13,7 @@
{
"type": "CameraComponent",
"view": "Perspective",
"fov": 120,
"fov": 60,
"near": 0.001,
"far": 1000,
"aspectRatio": 1.3333

View File

@@ -40,8 +40,9 @@
"mass": 1.0,
"restitution": 1.0,
"collisionShape": {
"type": "Sphere",
"radius": 1.0
"type": "Capsule",
"radius": 1.0,
"height": 2.0
}
},
{
@@ -79,6 +80,32 @@
}
]
},
{
"id": "Ceiling",
"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": "Ghost",
"mass": 0.0,
"restitution": 0.0,
"collisionShape": {
"type": "Box",
"halfExtents": [10.0, 10.0, 10.0]
}
},
{
"type": "ScriptComponent",
"script_name": "SideGhostController",
"script_path": "scripts://SideScene/ghost.lua"
}
]
},
{
"id": "Ground",
"components": [

View File

@@ -1,10 +1,20 @@
this.on_init = function()
this.speed = 0.1
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
this.on_fixedupdate = function()
if Input.getKeyDown(Input.KeyCode.Enter) then
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
gotoScene('SideScene')
end

View File

@@ -1,18 +1,28 @@
this.on_init = function()
this.speed = 0.1
this.original_position = this.position
this.cursor_locked = false
end
this.on_fixedupdate = function()
if Input.getKeyDown(Input.KeyCode.Enter) then
if Input.getKeyJustPressed(Input.KeyCode.Enter) then
gotoScene('MainScene')
end
if Input.getKeyDown(Input.KeyCode.L) then
if this.cursor_locked then
Input.unlockCursor()
else
Input.lockCursor()
end
this.cursor_locked = not this.cursor_locked
end
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, 0, 1) * this.speed
end
if Input.getKeyDown(Input.KeyCode.Down) then
this.position = this.position - Vec3:new(0, 1, 0) * this.speed
this.position = this.position + Vec3:new(0, 0, 1) * this.speed
end
if Input.getKeyDown(Input.KeyCode.Right) then
this.position = this.position + Vec3:new(1, 0, 0) * this.speed

View File

@@ -0,0 +1,8 @@
this.on_collisionenter = function(other)
print(other.name)
end
this.on_update = function ()
local player = getObject('Player.Child')
this.position = player.position + Vec3:new(0, 10, 0)
end

View File

@@ -1,6 +1,9 @@
-- this.on_collisionenter = function(other)
-- other.position = other.position + Vec3:new(3.2, 0, 0)
-- end
this.on_init = function()
print(this:getChild('Child').position:to_string())
end
this.on_update = function ()
rb = this:getComponent(Rigidbody)

View File

@@ -0,0 +1,5 @@
#version 450
void main() {
gl_Position = vec4(0);
}