123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- import type { Skeleton } from "../../Bones/skeleton";
- import { Vector3 } from "../../Maths/math.vector";
- import { PhysicsAggregate } from "./physicsAggregate";
- import type { Mesh } from "../../Meshes/mesh";
- import { TransformNode } from "../../Meshes/transformNode";
- /**
- * Ragdoll bone properties
- * @experimental
- */
- export declare class RagdollBoneProperties {
- /**
- * Width of the box shape
- */
- width?: number;
- /**
- * depth of the box shape
- */
- depth?: number;
- /**
- * height of the box shape
- */
- height?: number;
- /**
- * size that will be used of width, depth and height of the shape box
- */
- size?: number;
- /**
- * Type of Physics Constraint used between bones
- */
- joint?: number | undefined;
- /**
- * Main rotation axis used by the constraint, in local space
- */
- rotationAxis?: Vector3;
- /**
- * Minimum rotation angle value
- */
- min?: number;
- /**
- * Maximum rotation angle value
- */
- max?: number;
- /**
- * Offset along local axis
- */
- boxOffset?: number;
- /**
- * Axis that need an offset
- */
- boneOffsetAxis?: Vector3;
- }
- /**
- * Ragdoll for Physics V2
- * @experimental
- */
- export declare class Ragdoll {
- private _skeleton;
- private _scene;
- private _rootTransformNode;
- private _config;
- private _boxConfigs;
- private _joints;
- private _bones;
- private _initialRotation;
- private _initialRotation2;
- private _boneNames;
- private _transforms;
- private _aggregates;
- private _ragdollMode;
- private _rootBoneName;
- private _rootBoneIndex;
- private _mass;
- private _restitution;
- /**
- * Pause synchronization between physics and bone position/orientation
- */
- pauseSync: boolean;
- private _putBoxesInBoneCenter;
- private _defaultJoint;
- private _defaultJointMin;
- private _defaultJointMax;
- /**
- * Construct a new Ragdoll object. Once ready, it can be made dynamic by calling `Ragdoll` method
- * @param skeleton The skeleton containing bones to be physicalized
- * @param rootTransformNode The mesh or its transform used by the skeleton
- * @param config an array of `RagdollBoneProperties` corresponding to bones and their properties used to instanciate physics bodies
- */
- constructor(skeleton: Skeleton, rootTransformNode: Mesh | TransformNode, config: RagdollBoneProperties[]);
- /**
- * Returns the aggregate corresponding to the ragdoll bone index
- * @param index ragdoll bone aggregate index
- * @returns the aggregate for the bone index for the root aggregate if index is invalid
- */
- getAggregate(index: number): PhysicsAggregate;
- private _createColliders;
- private _initJoints;
- private _syncBonesToPhysics;
- private _setBoneOrientationToBody;
- private _syncBonesAndBoxes;
- private _setBodyOrientationToBone;
- private _defineRootBone;
- private _findNearestParent;
- private _init;
- /**
- * Enable ragdoll mode. Create physics objects and make them dynamic.
- */
- ragdoll(): void;
- /**
- * Dispose resources and remove physics objects
- */
- dispose(): void;
- }
|