mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
Construct a rigid body should be before the user script can access the rigid body (#4189)
This commit is contained in:
committed by
Weiliang Wang
parent
c75a164ac1
commit
449e7640dc
@@ -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) {
|
||||
|
||||
Vendored
+1
-1
@@ -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;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ import { RaycastResult } from './raycast-result';
|
||||
export enum ERigidBodyType {
|
||||
DYNAMIC = 1,
|
||||
STATIC = 2,
|
||||
KINEMATIC = 4
|
||||
KINEMATIC = 4,
|
||||
}
|
||||
|
||||
export function createPhysicsWorld (): PhysicsWorldBase {
|
||||
|
||||
Reference in New Issue
Block a user