Skip to content

Commit

Permalink
use Body.getVelocity in Matter.Render
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Dec 26, 2021
1 parent 10a2a07 commit bf90bdd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/render/Render.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var Render = {};

module.exports = Render;

var Body = require('../body/Body');
var Common = require('../core/Common');
var Composite = require('../body/Composite');
var Bounds = require('../geometry/Bounds');
Expand Down Expand Up @@ -1106,8 +1107,10 @@ var Mouse = require('../core/Mouse');
if (!body.render.visible)
continue;

var velocity = Body.getVelocity(body);

c.moveTo(body.position.x, body.position.y);
c.lineTo(body.position.x + (body.position.x - body.positionPrev.x) * 2, body.position.y + (body.position.y - body.positionPrev.y) * 2);
c.lineTo(body.position.x + velocity.x * 2, body.position.y + velocity.y * 2);
}

c.lineWidth = 3;
Expand Down

0 comments on commit bf90bdd

Please sign in to comment.