mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
use Body.getVelocity in Matter.Render
This commit is contained in:
parent
10a2a07ec2
commit
bf90bdd38c
1 changed files with 4 additions and 1 deletions
|
@ -10,6 +10,7 @@ var Render = {};
|
||||||
|
|
||||||
module.exports = Render;
|
module.exports = Render;
|
||||||
|
|
||||||
|
var Body = require('../body/Body');
|
||||||
var Common = require('../core/Common');
|
var Common = require('../core/Common');
|
||||||
var Composite = require('../body/Composite');
|
var Composite = require('../body/Composite');
|
||||||
var Bounds = require('../geometry/Bounds');
|
var Bounds = require('../geometry/Bounds');
|
||||||
|
@ -1106,8 +1107,10 @@ var Mouse = require('../core/Mouse');
|
||||||
if (!body.render.visible)
|
if (!body.render.visible)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
var velocity = Body.getVelocity(body);
|
||||||
|
|
||||||
c.moveTo(body.position.x, body.position.y);
|
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;
|
c.lineWidth = 3;
|
||||||
|
|
Loading…
Reference in a new issue