Files
cocos4/cocos/physics/framework/Physics-selector.ts
T
jiaxin.lai 344d1eebde Ammo-capsule (#6159)
* stash

* stash

* stash

* update @cocos/ammo to 1.0.1

* tweaks

* tweaks
2020-02-12 18:58:02 +08:00

45 lines
1.7 KiB
TypeScript

/**
* @hidden
*/
// Cannon
import { CannonRigidBody } from '../cannon/cannon-rigid-body';
import { CannonWorld } from '../cannon/cannon-world';
import { CannonBoxShape } from '../cannon/shapes/cannon-box-shape';
import { CannonSphereShape } from '../cannon/shapes/cannon-sphere-shape';
// built-in
import { BuiltInWorld } from '../cocos/builtin-world';
import { BuiltinBoxShape } from '../cocos/shapes/builtin-box-shape';
import { BuiltinSphereShape } from '../cocos/shapes/builtin-sphere-shape';
import { BuiltinCapsuleShape } from '../cocos/shapes/builtin-capsule-shape';
// Ammo
import { AmmoRigidBody } from '../ammo/ammo-rigid-body';
import { AmmoWorld } from '../ammo/ammo-world';
import { AmmoBoxShape } from '../ammo/shapes/ammo-box-shape';
import { AmmoSphereShape } from '../ammo/shapes/ammo-sphere-shape';
import { AmmoCapsuleShape } from '../ammo/shapes/ammo-capsule-shape';
export let BoxShape: typeof CannonBoxShape | typeof BuiltinBoxShape | typeof AmmoBoxShape;
export let SphereShape: typeof CannonSphereShape | typeof BuiltinSphereShape | typeof AmmoSphereShape;
export let RigidBody: typeof CannonRigidBody | null | typeof AmmoRigidBody;
export let PhysicsWorld: typeof CannonWorld | typeof BuiltInWorld | typeof AmmoWorld;
export let CapsuleShape: typeof BuiltinCapsuleShape | typeof AmmoCapsuleShape;
export function instantiate (
boxShape: typeof BoxShape,
sphereShape: typeof SphereShape,
body: typeof RigidBody,
world: typeof PhysicsWorld,
capsuleShape?: typeof CapsuleShape
) {
BoxShape = boxShape;
SphereShape = sphereShape;
RigidBody = body;
PhysicsWorld = world;
if (capsuleShape) {
CapsuleShape = capsuleShape;
}
}