Files
cocos4/cocos/physics/framework/instance.ts
T
jiaxin.lai 1a99b886b6 refactor physics framework & wrapper (#5667)
* basic physics abstract spec

* spec tweaks

* stash

* cannon refactor

* builtin refactor

* cannon wrapper & framework tweaks

* cannon wrapper import tweaks

* remve unneeded code

* group mask tweaks

* hiding, wait for 1.0.3

* builtin tweaks

* delete unneed code

* export CANNON

* update @cocos/cannon to 1.0.3

* using hasTigger property

* fix remove cannon body

* rebase

* update cannon version to 1.0.4

* rename stash

* rename I-rigid-body to i-rigid-body
2019-12-13 16:00:22 +08:00

26 lines
747 B
TypeScript

/**
* @hidden
*/
import { Vec3 } from '../../core/math';
import { BoxShape, PhysicsWorld, RigidBody, SphereShape } from './Physics-selector';
import { IRigidBody } from '../spec/i-rigid-body';
import { IBoxShape, ISphereShape } from '../spec/i-physics-shape';
import { IPhysicsWorld } from '../spec/i-physics-world';
export function createPhysicsWorld (): IPhysicsWorld {
return new PhysicsWorld() as IPhysicsWorld;
}
export function createRigidBody (): IRigidBody {
return new RigidBody!() as IRigidBody;
}
export function createBoxShape (size: Vec3): IBoxShape {
return new BoxShape(size) as IBoxShape;
}
export function createSphereShape (radius: number): ISphereShape {
return new SphereShape(radius) as ISphereShape;
}