0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-14 00:38:41 -04:00

most editable car

A better control for cars, when these have small dimensions, with tires with a diameter less than 40.
This commit is contained in:
YsraelJMM 2019-05-17 13:28:11 -05:00 committed by GitHub
parent 2ec247b7af
commit ec636a8eaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -235,11 +235,12 @@ var Bodies = require('./Bodies');
* @param {number} width
* @param {number} height
* @param {number} wheelSize
* @param {number} padding
* @return {composite} A new composite car body
*/
Composites.car = function(xx, yy, width, height, wheelSize) {
Composites.car = function(xx, yy, width, height, wheelSize, padding = 20) {
var group = Body.nextGroup(true),
wheelBase = 20,
wheelBase = padding,
wheelAOffset = -width * 0.5 + wheelBase,
wheelBOffset = width * 0.5 - wheelBase,
wheelYOffset = 0;