summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua81
1 files changed, 2 insertions, 79 deletions
diff --git a/main.lua b/main.lua
index d35872c..ebd4cd1 100644
--- a/main.lua
+++ b/main.lua
@@ -81,6 +81,7 @@ function setupEntities()
density = 1,
radius = 1,
},
+ surface = true,
velocity = Vec3{ 0, 0, 0 },
angularVelocity = Vec3{ 0, 0, 0 },
},
@@ -107,72 +108,10 @@ function setupEntities()
},
})
- local capsule = entities:createEntityWithComponents{
- node = {
- matrix = Mat4():identity():translate(Vec3{0,10,0}):rotateX(0.5*math.pi)
- },
- collision = {
- class = "capsule",
- radius = 1,
- length = 2,
- },
- physics = {
- mass = {
- class = "capsule",
- density = 1,
- direction = 3,
- radius = 1,
- length = 2,
- },
- maxAngularSpeed = 0,
- },
- renderMesh = {
- mesh = { filename="assets/capsule.obj", index=1 },
- shader = { vertex="vertex.glsl", fragment="fragment.glsl" },
- },
- script = { script = "scripts.capsuleMove" },
- }
-
-
- local pivotPivot = entities:createEntityWithComponents{
- node = {
- name = "p",
- parent = capsule,
- matrix = Mat4():identity():rotateX(-0.5*math.pi),
- },
- }
-
-
- local capcamPivot = entities:createEntityWithComponents{
- node = {
- name = "pivot",
- parent = pivotPivot,
- matrix = Mat4():identity(),
- },
- pitchyaw = {
- pitch = 0,
- yaw = 0,
- },
- onCursorPos = { script = "scripts.cameraPivot" },
- }
-
-
- local capcam = entities:createEntityWithComponents{
- camera = {
- projection = Mat4():perspective(math.rad(45), 640/480, 0.1, 1000),
- render="screen",
- },
- node = {
- parent = capcamPivot,
- matrix = Mat4():identity():translate(Vec3{0,0,20}),
- },
- onFramebufferSize = { script = "scripts.cameraHandleResize" },
- }
-
+ require('character')(entities)
local skybox = entities:createEntityWithComponents{
node = {
- parent = capsule,
matrix = Mat4():identity():scale(Vec3{2,2,2}):rotateX(math.rad(90))
},
renderMesh = {
@@ -190,22 +129,6 @@ function setupEntities()
},
}
-
- local camera = entities:createEntity()
- entities:addComponents(camera, {
- ccamera={
- projection=Mat4():perspective(math.rad(90), 640/480, 0.1, 1000),
- render="screen",
- },
- node={
- matrix=Mat4()
- :identity()
- :rotateX(math.rad(90))
- :translate(Vec3{0, 10, 0}),
- },
- onFramebufferSize = { script = "scripts.cameraHandleResize" },
- })
-
local misc = entities:createEntityWithComponents{
onKey = { script = "scripts.loadSaveQuit" },
onFramebufferSize = { script = "scripts.viewportResize" },