Files
cocos4/cocos/physics-2d/framework/physics-selector.ts
T
yinkaile 96a735b2ff 3d v1.2 physics 2d (#7357)
* Squashed commit of the following:

add physics 2d

* @@ -205,9 +205,6 @@ export class b2PhysicsWorld implements IPhysicsWorld {

revert box2d version

* add mask param to raycast

* refine code
2020-10-12 11:49:49 +08:00

38 lines
823 B
TypeScript

import { legacyCC } from '../../core/global-exports';
/**
* @hidden
*/
interface IPhysicsWrapperObject {
PhysicsWorld: any,
RigidBody?: any,
BoxShape: any,
CircleShape: any,
PolygonShape?: any,
DistanceJoint: any,
FixedJoint: any,
MouseJoint: any,
SpringJoint: any,
RelativeJoint: any,
SliderJoint: any,
WheelJoint: any,
HingeJoint: any,
}
type IPhysicsEngineId = 'builtin' | 'box2d' | string | undefined;
export let WRAPPER: IPhysicsWrapperObject;
export let physicsEngineId: IPhysicsEngineId;
export function select (id: IPhysicsEngineId, wrapper: IPhysicsWrapperObject) {
physicsEngineId = id;
legacyCC._global['CC_PHYSICS_2D_BUILTIN'] = id == 'builtin';
legacyCC._global['CC_PHYSICS_2D_BOX2D'] = id == "box2d";
WRAPPER = wrapper;
}