summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-04-14 15:55:34 -0500
committersanine-a <sanine.not@pm.me>2023-04-14 15:55:34 -0500
commit704614fde1a9062fa613b3b8646ee8108ccfb219 (patch)
treeca853e6dfc6a6b9a72de9d2193bf369eda4feaf9
parent01a8b2a3d98f816b8b712a974f3d1e98f05152f5 (diff)
add physics linear/angular velocity tracking
-rw-r--r--honey/ecs-systems.lua5
-rw-r--r--save3
2 files changed, 8 insertions, 0 deletions
diff --git a/honey/ecs-systems.lua b/honey/ecs-systems.lua
index 969b6fe..418f312 100644
--- a/honey/ecs-systems.lua
+++ b/honey/ecs-systems.lua
@@ -271,6 +271,11 @@ physics = function(params)
:identity()
:translate(Vec3{x,y,z})
:mul(Quaternion{a,b,c,d}:toMat4())
+
+ local vel = physics.velocity
+ vel[1], vel[2], vel[3] = ode.BodyGetLinearVel(physics._body)
+ local avel = physics.angularVelocity
+ avel[1], avel[2], avel[3] = ode.BodyGetAngularVel(physics._body)
end
end
end,
diff --git a/save b/save
new file mode 100644
index 0000000..2cd1c2c
--- /dev/null
+++ b/save
@@ -0,0 +1,3 @@
+Entity("84c91244-b225-4757-9ae2-501e4b933e12", {script={script="cameraRotationScript"},z={value=-60},onKey={script="cameraKeyHandler"},transform={matrix=Mat4{1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000, -59.2666, 0.0000, 0.0000, 0.0000, 1.0000}},camera={projection=Mat4{1.8107, 0.0000, 0.0000, 0.0000, 0.0000, 2.4142, 0.0000, 0.0000, 0.0000, 0.0000, -1.0020, -0.2002, 0.0000, 0.0000, -1.0000, 0.0000}},onWindowResize={script="cameraHandleResize"}})
+Entity("2a902813-02b8-49d6-9602-76ec6394cc86", {transform={matrix=Mat4{0.5222, -0.5222, 0.6743, 0.0000, 0.7071, 0.7071, -0.0000, 4.6250, -0.4768, 0.4768, 0.7385, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000}},renderMesh={textures={ourTexture={filename="77155.png"}},mesh={filename="assets/icosahedron.obj",index=1},shader={fragment="fragment.glsl",vertex="vertex.glsl"}},physics={velocity=Vec3{0.0000, 2.6000, 0.0000},angularVelocity=Vec3{0.0000, 1.0000, 0.0000},mass={radius=1,class="sphere",density=1}}})
+Entity("1dd0a59e-83ed-4358-a493-4a3c604f10bf", {transform={parent="2a902813-02b8-49d6-9602-76ec6394cc86",matrix=Mat4{1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000, 0.0000, 2.0000, 0.0000, 0.0000, 1.0000, 0.0000, 0.0000, 0.0000, 0.0000, 1.0000}},renderMesh={shader={fragment="fragment.glsl",vertex="vertex.glsl"},mesh={filename="assets/tetrahedron.obj",index=1}}})