0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-23 09:26:51 -05:00

use Body.getVelocity in Matter.Render

This commit is contained in:
liabru 2021-12-26 16:58:49 +00:00
parent 10a2a07ec2
commit bf90bdd38c

View file

@ -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');
@ -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;