UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

78 lines (77 loc) 3.11 kB
import type { World, ImpulseJoint } from '@dimforge/rapier3d-compat'; import { Object3D, Vector4, Vector3, Vector2 } from 'three'; import { PhysicsLib } from './CorePhysics'; import { PolyScene } from '../../engine/scene/PolyScene'; export declare enum PhysicsJointType { FIXED = "fixed", SPHERICAL = "spherical", REVOLUT = "revolute", PRISMATIC = "prismatic" } export declare const PHYSICS_JOINT_TYPES: PhysicsJointType[]; export declare const PHYSICS_JOINT_TYPE_MENU_ENTRIES: { name: PhysicsJointType; value: number; }[]; export declare enum PhysicsJointAttribute { JOIN_TYPE = "jointType", RBD_ID1 = "rbdId1", RBD_ID2 = "rbdId2", ANCHOR1 = "anchor1", ANCHOR2 = "anchor2", LIMIT = "limit", AXIS = "axis", FRAME1 = "frame1", FRAME2 = "frame2" } interface JointFixedData { frame1: Vector4; frame2: Vector4; } interface JointPrismaticData { axis: Vector3; limit: Vector2; } interface JointRevolutData { axis: Vector3; limit: Vector2; } export interface JointData { jointType: PhysicsJointType; rbdId1: string; rbdId2: string; anchor1: Vector3; anchor2: Vector3; data: { fixed?: JointFixedData; prismatic?: JointPrismaticData; revolut?: JointRevolutData; }; } export declare class CorePhysicsJoinAttribute { static setJoinType(object: Object3D, value: PhysicsJointType): void; static getJoinType(object: Object3D): PhysicsJointType; static setRBDId1(object: Object3D, value: string): void; static getRBDId1(object: Object3D): string; static setRBDId2(object: Object3D, value: string): void; static getRBDId2(object: Object3D): string; static setAnchor1(object: Object3D, value: Vector3): void; static getAnchor1(object: Object3D, value: Vector3): void; static setAnchor2(object: Object3D, value: Vector3): void; static getAnchor2(object: Object3D, value: Vector3): void; static setLimit(object: Object3D, value: Vector2): void; static getLimit(object: Object3D, value: Vector2): void; static setAxis(object: Object3D, value: Vector3): void; static getAxis(object: Object3D, value: Vector3): void; static setFrame1(object: Object3D, value: Vector4): void; static getFrame1(object: Object3D, value: Vector4): void; static setFrame2(object: Object3D, value: Vector4): void; static getFrame2(object: Object3D, value: Vector4): void; } export declare function setJointDataListForWorldObject(scene: PolyScene, worldObject: Object3D): void; export declare function physicsCreateJoints(PhysicsLib: PhysicsLib, world: World, worldObject: Object3D): void; export declare function physicsCreateJointFromJointData(PhysicsLib: PhysicsLib, world: World, jointData: JointData): ImpulseJoint | undefined; export declare function _createPhysicsRBDKinematicConstraint(rbdObject: Object3D, anchor: Vector3): string | undefined; export declare function _deletePhysicsRBDKinematicConstraint(scene: PolyScene, object: Object3D): void; export declare function _physicsRBDDeleteConstraints(rbdObject: Object3D): void; export {};