Files
cocos4/cocos/3d/physics/instance.ts
T
jiaxin.lai 38c2478b19 Add method to collider (#4561)
* Fix bug of Cannon physics

* Add on、off、once to collider-component

* Modify collision event emit param

* Rename ColliderComponentBase to ColliderComponent and export ColliderComponent;

* Add export-api file for export some physics api to user

* on、off、once Change to private

* Collider manage collision event
2019-06-11 17:32:33 +08:00

27 lines
855 B
TypeScript

import { Vec3 } from '../../core/value-types';
import { BoxShapeBase, ICreateBodyOptions, PhysicsWorldBase, RigidBodyBase, SphereShapeBase } from './api';
import { BoxShape, PhysicsWorld, RigidBody, SphereShape } from './impl-selector';
import { RaycastResult } from './raycast-result';
export function createPhysicsWorld (): PhysicsWorldBase {
return new PhysicsWorld();
}
export function createRigidBody (options?: ICreateBodyOptions): RigidBodyBase {
return new RigidBody(options) as RigidBodyBase;
}
export function createBoxShape (size: Vec3): BoxShapeBase {
return new BoxShape(size);
}
export function createSphereShape (radius: number): SphereShapeBase {
return new SphereShape(radius);
}
export function createRaycastResult (): RaycastResult {
return new RaycastResult();
}
cc.createRaycastResult = createRaycastResult;