summaryrefslogtreecommitdiff
path: root/main.lua
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2023-05-18 22:23:42 -0500
committersanine <sanine.not@pm.me>2023-05-18 22:23:42 -0500
commiteafff1e04eb7f6a63818db035d2c6a277c5c364c (patch)
treec32d7bb4fde9408539d13ce43dc0ff4824765412 /main.lua
parent4b2507b2f30d50c8673f33179c2b537ac83da3bf (diff)
visualize collisionsrefactor
Diffstat (limited to 'main.lua')
-rw-r--r--main.lua34
1 files changed, 30 insertions, 4 deletions
diff --git a/main.lua b/main.lua
index 2542910..f5237a5 100644
--- a/main.lua
+++ b/main.lua
@@ -48,11 +48,23 @@ db:createEntityWithComponents{
},
}
+
+local parent = db:createEntityWithComponents{
+ node = {
+ matrix = Mat4()
+ :identity()
+ },
+ script = { script = "scripts.update" },
+}
+
-- mesh
db:createEntityWithComponents{
node = {
+ parent = parent,
matrix = Mat4()
- :identity(),
+ :identity()
+ :rotateX(0.5*math.pi)
+ :rotateZ(0.5*math.pi)
},
renderMesh = {
mesh = {
@@ -67,14 +79,28 @@ db:createEntityWithComponents{
shader = { vertex="vertex.glsl", fragment="fragment.glsl" },
},
collision = {
- class = "capsule",
+ class = "ray",
radius = 1,
- length = 2,
+ length = 4,
lx = 2,
ly = 2,
lz = 2,
},
- script = { script = "scripts.rotate" },
+ onCollision = { script = "scripts.collide" },
+}
+
+
+-- box?
+db:createEntityWithComponents{
+ node = {
+ matrix = Mat4()
+ :identity()
+ :translate(Vec3{0,-3,0})
+ },
+ collision = {
+ class = "box",
+ lx = 1, ly=1, lz=1,
+ },
}
honey.loop(function(dt)