mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
1a99b886b6
* 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
26 lines
747 B
TypeScript
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;
|
|
}
|