import { HavokPhysicsWithBindings } from '@babylonjs/havok'; import { IRigidBody, MotionType } from './components/IRigidBody'; import * as THREE from 'three'; /** Type of Shape */ export declare enum PhysicsShapeType { SPHERE = "Sphere", BOX = "Box", CONVEX_HULL = "ConvexHull", MESH = "Mesh" } /** * Helper to keep a reference to plugin memory. * Used to avoid https://github.com/emscripten-core/emscripten/issues/7294 * @internal * @ignore */ export interface PluginMemoryRef { /** The offset from the beginning of the plugin's heap */ offset: number; /** The number of identically-sized objects the buffer contains */ numObjects: number; } /** * Parameters used to describe the shape of a Physics Body */ export declare enum Shape { /** * A sphere shape, with a radius */ SPHERE = "Sphere", /** * A box shape, with a width, height, and depth */ BOX = "Box", /** * Use the mesh vertices directly as the collision shape */ MESH = "Mesh", /** * Use the convex hull of the mesh as the collision shape */ CONVEX_HULL = "Convex Hull" } /** * Determines how values from the PhysicsMaterial are combined when * two objects are in contact. When each PhysicsMaterial specifies * a different combine mode for some property, the combine mode which * is used will be selected based on their order in this enum - i.e. * a value later in this list will be preferentially used. */ export declare enum PhysicsMaterialCombineMode { /** * The final value will be the geometric mean of the two values: * sqrt( valueA * valueB ) */ GEOMETRIC_MEAN = 0, /** * The final value will be the smaller of the two: * min( valueA , valueB ) */ MINIMUM = 1, MAXIMUM = 2, ARITHMETIC_MEAN = 3, /** * The final value will be the product of the two values: * valueA * valueB */ MULTIPLY = 4 } export declare enum CombineMode { GeometryMean = "GeometryMean", Minimum = "Minimum", Maximum = "Maximum", ArithmeticMean = "ArithmeticMean", Multiply = "Multiply" } export declare function translateCombineMode(mode: PhysicsMaterialCombineMode): CombineMode; export declare function translatePhysicsMaterialCombineMode(mode: CombineMode): PhysicsMaterialCombineMode; /** * Collision object that is the parameter when notification for collision fires. */ export interface IPhysicsCollisionEvent { /** * 1st physics body that collided */ collider: IRigidBody; /** * 2nd physics body that collided */ collidedAgainst: IRigidBody; /** * index in instances array for the collider */ colliderIndex?: number; /** * index in instances array for the collidedAgainst */ collidedAgainstIndex?: number; /** * World position where the collision occured */ point: THREE.Vector3; /** * Penetration distance */ distance: number; /** * Impulse value computed by the solver response */ impulse: number; /** * Collision world normal direction */ normal: THREE.Vector3; } /** * Parameters used to describe mass and inertia of the Physics Body */ export interface PhysicsMassProperties { /** * The center of mass, in local space. This is The * point the body will rotate around when applying * an angular velocity. * * If not provided, the physics engine will compute * an appropriate value. */ centerOfMass?: [number, number, number]; /** * The total mass of this object, in kilograms. This * affects how easy it is to move the body. A value * of zero will be used as an infinite mass. * * If not provided, the physics engine will compute * an appropriate value. */ mass?: number; /** * The principal moments of inertia of this object * for a unit mass. This determines how easy it is * for the body to rotate. A value of zero on any * axis will be used as infinite interia about that * axis. * * If not provided, the physics engine will compute * an appropriate value. */ inertia?: [number, number, number]; /** * The rotation rotating from inertia major axis space * to parent space (i.e., the rotation which, when * applied to the 3x3 inertia tensor causes the inertia * tensor to become a diagonal matrix). This determines * how the values of inertia are aligned with the parent * object. * * If not provided, the physics engine will compute * an appropriate value. */ inertiaOrientation?: [number, number, number, number]; } /** Type of Constraint */ export declare enum PhysicsConstraintType { /** * A ball and socket constraint will attempt to line up the pivot * positions in each body, and have no restrictions on rotation */ BALL_AND_SOCKET = "BallAndSocket", /** * A distance constraint will attempt to keep the pivot locations * within a specified distance. */ DISTANCE = "Distance", /** * A hinge constraint will keep the pivot positions aligned as well * as two angular axes. The remaining angular axis will be free to rotate. */ HINGE = "Hinge", /** * A slider constraint allows bodies to translate along one axis and * rotate about the same axis. The remaining two axes are locked in * place */ SLIDER = "Slider", /** * A lock constraint will attempt to keep the pivots completely lined * up between both bodies, allowing no relative movement. */ LOCK = "Lock", PRISMATIC = "Prismatic", SIX_DOF = "SixDoF" } export declare enum PhysicsConstraintAxisLimitMode { FREE = "Free", LIMITED = "Limited", LOCKED = "Locked" } /** The constraint specific axis to use when setting Friction, `ConstraintAxisLimitMode`, max force, ... */ export declare enum PhysicsConstraintAxis { LINEAR_X = "LinearX", LINEAR_Y = "LinearY", LINEAR_Z = "LinearZ", ANGULAR_X = "AngularX", ANGULAR_Y = "AngularY", ANGULAR_Z = "AngularZ", LINEAR_DISTANCE = "LinearDistance" } /** Optional motor which attempts to move a body at a specific velocity, or at a specific position */ export declare enum PhysicsConstraintMotorType { NONE = "None", VELOCITY = "Velocity", POSITION = "Position" } /** * Indicates how to handle position/rotation changes of scene objects attached to physics bodies */ export declare enum PhysicsPrestepType { /** * No prestep processing. The body will still respond to transform changes from observables * and editor controls, but without the specialized prestep handling. */ DISABLED = "Disabled", /** * Teleport mode. The body will be moved to the new position/rotation but with limited * interaction with shapes in contact. Use this for UI manipulations, gizmos, or when * you want to position objects without full physics interaction. */ TELEPORT = "Teleport", /** * Action mode. The body will smoothly move to the new position/rotation and interact * fully with shapes in contact. Use this for in-game movement where realistic physics * behavior is desired. */ ACTION = "Action" } export declare function _materialCombineToNative(mat: PhysicsMaterialCombineMode, havok: HavokPhysicsWithBindings): any; export declare function _nativeToMaterialCombine(mat: any, havok: HavokPhysicsWithBindings): PhysicsMaterialCombineMode | undefined; export declare function _translateMotionType(motion: MotionType, havok: HavokPhysicsWithBindings): any; export declare function _fromMassPropertiesTuple(massPropsTuple: any[]): PhysicsMassProperties;