diff --git a/cocos/3d/framework/physics/collider-component.ts b/cocos/3d/framework/physics/collider-component.ts index 705dc3699e..722d1b1630 100644 --- a/cocos/3d/framework/physics/collider-component.ts +++ b/cocos/3d/framework/physics/collider-component.ts @@ -21,7 +21,7 @@ export class ColliderComponentBase extends PhysicsBasedComponent { set isTrigger (value) { this._triggered = value; if (this._body) { - let type = this._triggered ? ERigidBodyType.DYNAMIC : ERigidBodyType.STATIC; + const type = this._triggered ? ERigidBodyType.DYNAMIC : ERigidBodyType.STATIC; this._body.setType(type); this._body.setIsTrigger(value); } diff --git a/cocos/3d/physics/cannon-impl.ts b/cocos/3d/physics/cannon-impl.ts index e8ef421c58..b8cc541961 100644 --- a/cocos/3d/physics/cannon-impl.ts +++ b/cocos/3d/physics/cannon-impl.ts @@ -453,22 +453,15 @@ export class CannonRigidBody implements RigidBodyBase { } private _onWorldBeforeStep () { - // this._useGravity = false; - if (!this._useGravity) { - const gravity = this._cannonBody.world.gravity; - vec3.scaleAndAdd(this._cannonBody.force, this._cannonBody.force, gravity, this._cannonBody.mass * -1); - } } private _onWorldPostStep (event: CANNON.IEvent) { } private _onSelfPreStep () { - // this._useGravity = false; - // if (!this._useGravity) { - // const gravity = this._cannonBody.world.gravity; - // vec3.scaleAndAdd(this._cannonBody.force, this._cannonBody.force, gravity, this._cannonBody.mass * -1); - // } + if (!this._useGravity) { + this._cannonBody.force.y -= this._cannonBody.mass * this._cannonBody.world.gravity.y; + } } private _onSelfPostStep () {