Files
cocos4/cocos/physics/framework/Physics-selector.ts
T
jiaxin.lai 21cc4351c6 builtin_capsule_collider (#5970)
* add bouding capsule

* add builtin capsule collider

* add apater for capsule shape

* fix circular dependency

* fix typing

* fix capsule_capsule algorithm

* api doc tweaks

* fix ci
2019-12-27 18:11:44 +08:00

44 lines
1.6 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';
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;
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;
}
}