mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-05 19:12:40 +08:00
cb2786a789
* update cannon.js & cannon.js declaration * plugin cannon.js collsion event & provide contacts(testing for now) * wrap cannon body impl * add linear\angular factor to rigidbody component * add awake sleepy sleeping state query get property * add apply local force/impulse function to rigidbody component * add builtin macro protection * add linear/angular veloctiy function to rigidbody component * delete some unneed code, enable allowSleep by default * event refactor, trigger emit by shape, collision emit by rigidBody * Builtin system also need 'beforeStep'
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { Vec3 } from '../../core/value-types';
|
|
import { ColliderComponent } from '../framework/physics/collider/collider-component';
|
|
import { RigidBodyComponent } from '../framework/physics/rigid-body-component';
|
|
|
|
export interface ITriggerEvent {
|
|
readonly type: TriggerEventType;
|
|
readonly selfCollider: ColliderComponent;
|
|
readonly otherCollider: ColliderComponent;
|
|
}
|
|
|
|
export type TriggerEventType = 'onTriggerEnter' | 'onTriggerStay' | 'onTriggerExit';
|
|
|
|
export type TriggerCallback = (event: ITriggerEvent) => void;
|
|
|
|
export interface IContactEquation {
|
|
readonly contactA: Vec3;
|
|
readonly contactB: Vec3;
|
|
readonly normal: Vec3;
|
|
}
|
|
|
|
export interface ICollisionEvent {
|
|
readonly type: CollisionEventType;
|
|
readonly selfCollider: ColliderComponent;
|
|
readonly otherCollider: ColliderComponent;
|
|
readonly contacts: IContactEquation[];
|
|
}
|
|
|
|
export type CollisionEventType = 'onCollisionEnter' | 'onCollisionStay' | 'onCollisionExit';
|
|
|
|
export type CollisionCallback = (event: ICollisionEvent) => void;
|