mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
21cc4351c6
* 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
44 lines
1.6 KiB
TypeScript
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;
|
|
}
|
|
}
|