mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 18:42:40 +08:00
7d944f0813
* Optimize physics selector * CI * Update
39 lines
948 B
TypeScript
39 lines
948 B
TypeScript
import { legacyCC } from '../../core/global-exports';
|
|
|
|
/**
|
|
* @hidden
|
|
*/
|
|
interface IPhysicsWrapperObject {
|
|
PhysicsWorld: any,
|
|
RigidBody?: any,
|
|
|
|
BoxShape: any,
|
|
SphereShape: any,
|
|
CapsuleShape?: any,
|
|
TrimeshShape?: any,
|
|
CylinderShape?: any,
|
|
ConeShape?: any,
|
|
TerrainShape?: any,
|
|
SimplexShape?: any,
|
|
PlaneShape?: any,
|
|
|
|
PointToPointConstraint?: any,
|
|
HingeConstraint?: any,
|
|
ConeTwistConstraint?: any,
|
|
}
|
|
|
|
type IPhysicsEngineId = 'builtin' | 'cannon.js' | 'ammo.js' | string | undefined;
|
|
|
|
export let WRAPPER: IPhysicsWrapperObject;
|
|
|
|
export let physicsEngineId: IPhysicsEngineId;
|
|
|
|
export function select (id: IPhysicsEngineId, wrapper: IPhysicsWrapperObject) {
|
|
physicsEngineId = id;
|
|
legacyCC._global['CC_PHYSICS_BUILTIN'] = id == 'builtin';
|
|
legacyCC._global['CC_PHYSICS_CANNON'] = id == "cannon.js";
|
|
legacyCC._global['CC_PHYSICS_AMMO'] = id == "ammo.js";
|
|
|
|
WRAPPER = wrapper;
|
|
}
|