import { OimoJointType, OimoShapeType } from '.'; import { BaseBodyOptions, Vec2, Vec3, Vec4 } from '../common/physics'; import { OimoRigidBody } from './RigidBody'; export interface OimoWorldOptions { timestep?: number; iterations?: number; broadphase?: number; worldscale?: number; random?: boolean; info?: boolean; gravity?: Vec3; } declare type OimoShapeOptionsAll = OimoBoxShapeOptions | OimoSphereShapeOptions | OimoCylinderShapeOptions; export interface OimoRigidBodyOptions extends BaseBodyOptions { density?: number; shapes?: OimoShapeOptionsAll | OimoShapeOptionsAll[]; allowSleep?: boolean; position?: Vec3; rotation?: Vec4; scale?: Vec3; } export interface OimoShapeOptions { type: OimoShapeType; /** * shape实例 */ /** * shape position */ position?: Vec3; /** * shape rotation 使用的是角度 */ rotation?: Vec3; } export interface OimoBoxShapeOptions extends OimoShapeOptions { type: OimoShapeType.box; width: number; height: number; depth: number; } export interface OimoSphereShapeOptions extends OimoShapeOptions { type: OimoShapeType.sphere; radius: number; } export interface OimoCylinderShapeOptions extends OimoShapeOptions { type: OimoShapeType.cylinder; radius: number; height: number; } export interface OimoJointOptions { type: OimoJointType; name?: string; mainBody: OimoRigidBody; connectedBody: OimoRigidBody; mainAxis: Vec3; connectedAxis: Vec3; mainPivot: Vec3; connectedPivot: Vec3; collision?: boolean; } export interface OimoDistanceJointOptions extends OimoJointOptions { type: OimoJointType.distance; min: number; max: number; spring?: Vec2; motor?: Vec2; } export interface OimoHingeJointOptions extends OimoJointOptions { type: OimoJointType.hinge; name?: string; min: number; max: number; spring?: Vec2; motor?: Vec2; } export interface OimoPrismeJointOptions extends OimoJointOptions { type: OimoJointType.prisme; min: number; max: number; } export interface OimoSlideJointOptions extends OimoJointOptions { type: OimoJointType.slider; min: number; max: number; } export interface OimoBallJointOptions extends OimoJointOptions { type: OimoJointType.ball; } export interface OimoWheelJointOptions extends OimoJointOptions { type: OimoJointType.wheel; limit: Vec2; spring: Vec2; motor: Vec2; } export {};