From a315509189073cdaf4172bcfd4e4a54e5c8c87eb Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Tue, 2 Mar 2021 20:03:02 -0500 Subject: Updated stylings and very nearly have square collisions complete and proper --- frontend/_shared/math/line2.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'frontend/_shared/math/line2.js') diff --git a/frontend/_shared/math/line2.js b/frontend/_shared/math/line2.js index a9e72be..8b30c1c 100644 --- a/frontend/_shared/math/line2.js +++ b/frontend/_shared/math/line2.js @@ -32,7 +32,8 @@ function line2(pStart, pEnd, pGl, pColor, pMass) { length: length2(lDiffVector), mass: pMass, direction: normalize2(lDiffVector), - velocity: vec2(0, 0) + velocity: vec2(0, 0), + position: vec2() }; } @@ -40,6 +41,13 @@ function getLine2MomentOfInertia(pLine) { return (1.0 / 12.0) * pLine.mass * Math.pow(pLine.length, 2); } +function getLine2MidPoint(pLine) { + return { + x: (pLine.end.x + pLine.start.x) / 2.0, + y: (pLine.end.y + pLine.start.y) / 2.0 + } +} + function renderLine2(pGl, pProgramInfo, pLine) { pGl.uniformMatrix4fv(pProgramInfo.uniformLocations.model, false, mat4()); // Model on a line is always default matrix pGl.bindBuffer(pGl.ARRAY_BUFFER, pLine.buffer); -- cgit v1.2.1