Construct a rigid body should be before the user script can access the rigid body (#4189)

This commit is contained in:
jiaxin.lai
2019-04-11 14:54:51 +08:00
committed by Weiliang Wang
parent c75a164ac1
commit 449e7640dc
4 changed files with 8 additions and 5 deletions
@@ -22,11 +22,14 @@ export class PhysicsBasedComponent extends Component {
super();
}
public __preload () {
this._refSharedBody();
}
public onLoad () {
}
public start () {
this._refSharedBody();
}
public destroy () {
@@ -198,8 +198,8 @@ export class RigidBodyComponent extends PhysicsBasedComponent {
this._body!.applyForce(force, position);
}
public applyImpulse (impulse: Vec3) {
this._body!.applyImpulse(impulse);
public applyImpulse (impulse: Vec3, position?: Vec3) {
this._body!.applyImpulse(impulse, position);
}
public setCollisionFilter (group: number, mask: number) {
+1 -1
View File
@@ -74,7 +74,7 @@ export class RigidBodyBase {
applyForce (force: Vec3, position?: Vec3): void;
applyImpulse (impulse: Vec3): void;
applyImpulse (impulse: Vec3, position?: Vec3): void;
getIsKinematic (): boolean;
+1 -1
View File
@@ -6,7 +6,7 @@ import { RaycastResult } from './raycast-result';
export enum ERigidBodyType {
DYNAMIC = 1,
STATIC = 2,
KINEMATIC = 4
KINEMATIC = 4,
}
export function createPhysicsWorld (): PhysicsWorldBase {