diff --git a/examples/spark/package-lock.json b/examples/spark/package-lock.json index cab0a93..b919e58 100644 --- a/examples/spark/package-lock.json +++ b/examples/spark/package-lock.json @@ -4118,9 +4118,9 @@ } }, "physar": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/physar/-/physar-0.1.2.tgz", - "integrity": "sha512-xTAkiUourfIN0EM/XmABJVHmTxezbDeZNlMxKbYzGp/eJ2H+TLOTOFDpvPro/wB7kLinPiONy+R/+RU/8VMHTw==" + "version": "0.1.9-0", + "resolved": "https://registry.npmjs.org/physar/-/physar-0.1.9-0.tgz", + "integrity": "sha512-hTLsN6Gpa17AebioHsfaPuduAhnA62W0idOtUYJfNL1jcFT9Lvptwo20Ra4W/ZHpyiqP+5EIRt9r8OMQF7YpVA==" }, "pify": { "version": "4.0.1", diff --git a/examples/spark/package.json b/examples/spark/package.json index df19801..19029ec 100644 --- a/examples/spark/package.json +++ b/examples/spark/package.json @@ -10,7 +10,7 @@ "start": "npm run dev" }, "dependencies": { - "physar": "^0.1.2", + "physar": "^0.1.9-0", "short-uuid": "^3.1.1", "webpack": "^4.41.6" }, diff --git a/examples/spark/src/index.js b/examples/spark/src/index.js index 7bb3562..cf7fd93 100644 --- a/examples/spark/src/index.js +++ b/examples/spark/src/index.js @@ -59,6 +59,8 @@ const groundProps = { } } physar.createObject(plane, 'ground', groundProps) -physar.createObject(sphere, 'sphere', sphereProps) -physar.createObject(cube, 'box', cubeProps) +const sphereID = physar.createObject(sphere, 'sphere', sphereProps) +const boxID = physar.createObject(cube, 'box', cubeProps) + +const constraint = physar.addConstrait(sphereID, boxID) physar.start() diff --git a/src/index.js b/src/index.js index ab3f740..7a240f0 100644 --- a/src/index.js +++ b/src/index.js @@ -322,7 +322,7 @@ export default class Physar { // We need at least two bodies to make a constraint. if ( !params.bodyA || !params.bodyB) return - let { bodyA, bodyB, pivotA, pivotB, axisA, axisB } = params + let [bodyA, bodyB, pivotA, pivotB, axisA, axisB] = params const options = { pivotA, pivotB, @@ -404,12 +404,12 @@ export default class Physar { resumeConstraint(id) { const c = this.find('constraint', id) - const {id, constraint} = c + const [id, constraint] = c if(c && c.isActive == false) { this.world.addConstraint(constraint) - + const idx = this.worldConstraints.indexOf(c) this.worldConstraints[idx].isActive = true }