Skip to content

Commit f75277d

Browse files
committed
Simplify code
1 parent 8e05a31 commit f75277d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/framework/components/joint/component.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { Component } from '../component.js';
1212
* @augments Component
1313
* @classdesc The JointComponent adds a physics joint constraint linking two rigid bodies.
1414
* @param {JointComponentSystem} system - The ComponentSystem that created this Component.
15+
* @param {Entity} entity - The Entity that this Component is attached to.
1516
*/
1617
class JointComponent extends Component {
1718
constructor(system, entity) {
@@ -262,11 +263,11 @@ class JointComponent extends Component {
262263
const axis = ['X', 'Y', 'Z', 'X', 'Y', 'Z'];
263264

264265
for (let i = 0; i < 6; i++) {
265-
const type = i < 3 ? 'linear' : 'angular';
266-
this._constraint.enableSpring(i, this['_' + type + 'Spring' + axis[i]]);
267-
this._constraint.setDamping(i, this['_' + type + 'Damping' + axis[i]]);
268-
this._constraint.setEquilibriumPoint(i, this['_' + type + 'Equilibrium' + axis[i]]);
269-
this._constraint.setStiffness(i, this['_' + type + 'Stiffness' + axis[i]]);
266+
const type = i < 3 ? '_linear' : '_angular';
267+
this._constraint.enableSpring(i, this[type + 'Spring' + axis[i]]);
268+
this._constraint.setDamping(i, this[type + 'Damping' + axis[i]]);
269+
this._constraint.setEquilibriumPoint(i, this[type + 'Equilibrium' + axis[i]]);
270+
this._constraint.setStiffness(i, this[type + 'Stiffness' + axis[i]]);
270271
}
271272

272273
this._constraint.setBreakingImpulseThreshold(this._breakForce);

0 commit comments

Comments
 (0)