diff --git a/cocos/3d/framework/physics/default-material.ts b/cocos/3d/framework/physics/default-material.ts index 86be5e723e..02c1b3eea1 100644 --- a/cocos/3d/framework/physics/default-material.ts +++ b/cocos/3d/framework/physics/default-material.ts @@ -3,8 +3,8 @@ import { PhysicsMaterial } from '../../assets/physics/material'; export const DefaultPhysicsMaterial: PhysicsMaterial = (() => { const result = new PhysicsMaterial(); - result.friction = 0.3; - result.restitution = 0.3; + result.friction = -1; + result.restitution = -1; return result; })(); diff --git a/cocos/3d/framework/physics/detail/physics-based-component.ts b/cocos/3d/framework/physics/detail/physics-based-component.ts index bf916b2bce..0b882d89ef 100644 --- a/cocos/3d/framework/physics/detail/physics-based-component.ts +++ b/cocos/3d/framework/physics/detail/physics-based-component.ts @@ -26,6 +26,7 @@ export class PhysicsBasedComponent extends Component { public onLoad () { this._refSharedBody(); + this._sharedBody!.syncPhysWithScene(); } public start () { diff --git a/cocos/3d/framework/physics/rigid-body-component.ts b/cocos/3d/framework/physics/rigid-body-component.ts index fa59b52bbf..45f9ca12c3 100644 --- a/cocos/3d/framework/physics/rigid-body-component.ts +++ b/cocos/3d/framework/physics/rigid-body-component.ts @@ -204,6 +204,10 @@ export class RigidBodyComponent extends PhysicsBasedComponent { this._body!.applyForce(toCannonVec3(force), toCannonVec3(position)); } + public applyImpulse (impulse: Vec3) { + this._body!.applyImpulse(toCannonVec3(impulse), toCannonVec3(new Vec3())); + } + /** * Set the collision filter of this body, remember that they are tested bitwise. * @param {number} group The group which this body will be put into. diff --git a/cocos/3d/framework/physics/util.ts b/cocos/3d/framework/physics/util.ts index 7022d80364..aedd3aa24d 100644 --- a/cocos/3d/framework/physics/util.ts +++ b/cocos/3d/framework/physics/util.ts @@ -1,3 +1,4 @@ +import CANNON from 'cannon'; import { Vec3 } from '../../../core/value-types'; export interface IWrappedCANNON { diff --git a/cocos/3d/framework/physics/world.ts b/cocos/3d/framework/physics/world.ts index d65de3f7f2..6fb0221b58 100644 --- a/cocos/3d/framework/physics/world.ts +++ b/cocos/3d/framework/physics/world.ts @@ -48,6 +48,7 @@ export class PhysicsWorld { constructor () { this._defaultContactMaterial = new ContactMaterial(DefaultPhysicsMaterial, DefaultPhysicsMaterial); + this._defaultContactMaterial.friction = 0; this._cannonWorld = new CANNON.World(); setWrap(this._cannonWorld, this);