mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
38c2478b19
* 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
27 lines
855 B
TypeScript
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;
|