rhodonite 0.19.9 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/effekseer/main.d.ts +3 -1
- package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esm/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esm/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esm/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esm/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esm/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esm/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esm/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esm/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esm/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esm/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esm/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esm/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esm/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esm/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esm/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esm/foundation/components/index.d.ts +3 -0
- package/dist/esm/foundation/core/Component.d.ts +63 -3
- package/dist/esm/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esm/foundation/core/Config.d.ts +8 -7
- package/dist/esm/foundation/core/Entity.d.ts +15 -0
- package/dist/esm/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esm/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esm/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esm/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esm/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esm/foundation/geometry/index.d.ts +1 -0
- package/dist/esm/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esm/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esm/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esm/foundation/gizmos/index.d.ts +1 -0
- package/dist/esm/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esm/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esm/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esm/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esm/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esm/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esm/foundation/importer/index.d.ts +2 -0
- package/dist/esm/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esm/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esm/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esm/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esm/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esm/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esm/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esm/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esm/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esm/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esm/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esm/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esm/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esm/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esm/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esm/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esm/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esm/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esm/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esm/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esm/foundation/math/Scalar.d.ts +13 -14
- package/dist/esm/foundation/math/Vector2.d.ts +38 -38
- package/dist/esm/foundation/math/Vector3.d.ts +55 -54
- package/dist/esm/foundation/math/Vector4.d.ts +54 -55
- package/dist/esm/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esm/foundation/misc/Time.d.ts +10 -1
- package/dist/esm/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esm/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esm/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esm/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esm/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esm/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esm/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esm/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esm/foundation/physics/index.d.ts +2 -0
- package/dist/esm/index.js +728 -723
- package/dist/esm/types/AnimationTypes.d.ts +1 -1
- package/dist/esm/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esm/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esm/types/VRMC.d.ts +12 -12
- package/dist/esm/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esm/types/glTF2.d.ts +8 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/webgl/main.d.ts +2 -1
- package/dist/esm/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/dist/esmdev/effekseer/main.d.ts +3 -1
- package/dist/esmdev/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esmdev/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esmdev/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esmdev/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esmdev/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esmdev/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esmdev/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esmdev/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esmdev/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esmdev/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esmdev/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esmdev/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esmdev/foundation/components/index.d.ts +3 -0
- package/dist/esmdev/foundation/core/Component.d.ts +63 -3
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esmdev/foundation/core/Config.d.ts +8 -7
- package/dist/esmdev/foundation/core/Entity.d.ts +15 -0
- package/dist/esmdev/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esmdev/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esmdev/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esmdev/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esmdev/foundation/geometry/index.d.ts +1 -0
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esmdev/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esmdev/foundation/gizmos/index.d.ts +1 -0
- package/dist/esmdev/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esmdev/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esmdev/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esmdev/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esmdev/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esmdev/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esmdev/foundation/importer/index.d.ts +2 -0
- package/dist/esmdev/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esmdev/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esmdev/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esmdev/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esmdev/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esmdev/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esmdev/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esmdev/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esmdev/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esmdev/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esmdev/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esmdev/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esmdev/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esmdev/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esmdev/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esmdev/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esmdev/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esmdev/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esmdev/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esmdev/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esmdev/foundation/math/Scalar.d.ts +13 -14
- package/dist/esmdev/foundation/math/Vector2.d.ts +38 -38
- package/dist/esmdev/foundation/math/Vector3.d.ts +55 -54
- package/dist/esmdev/foundation/math/Vector4.d.ts +54 -55
- package/dist/esmdev/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esmdev/foundation/misc/Time.d.ts +10 -1
- package/dist/esmdev/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esmdev/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esmdev/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esmdev/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esmdev/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esmdev/foundation/physics/index.d.ts +2 -0
- package/dist/esmdev/index.js +35168 -27712
- package/dist/esmdev/types/AnimationTypes.d.ts +1 -1
- package/dist/esmdev/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esmdev/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esmdev/types/VRMC.d.ts +12 -12
- package/dist/esmdev/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esmdev/types/glTF2.d.ts +8 -0
- package/dist/esmdev/types/index.d.ts +2 -0
- package/dist/esmdev/webgl/main.d.ts +2 -1
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/package.json +25 -23
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { IEntity } from '../core/Entity';
|
|
2
|
+
import { type IVector3 } from '../math';
|
|
3
|
+
export interface PhysicsQueryCandidate {
|
|
4
|
+
entity: IEntity;
|
|
5
|
+
bindingId?: number;
|
|
6
|
+
isSensor: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface PhysicsRaycastHit extends PhysicsQueryCandidate {
|
|
9
|
+
position: IVector3;
|
|
10
|
+
normal: IVector3;
|
|
11
|
+
distance: number;
|
|
12
|
+
fraction: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PhysicsShapeCastHit extends PhysicsQueryCandidate {
|
|
15
|
+
position: IVector3;
|
|
16
|
+
normal: IVector3;
|
|
17
|
+
distance: number;
|
|
18
|
+
fraction: number;
|
|
19
|
+
}
|
|
20
|
+
export interface PhysicsColliderQueryTarget {
|
|
21
|
+
entity: IEntity;
|
|
22
|
+
bindingId?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface PhysicsRaycastOptions {
|
|
25
|
+
includeSensors?: boolean;
|
|
26
|
+
solid?: boolean;
|
|
27
|
+
collisionGroup?: number;
|
|
28
|
+
collisionMask?: number;
|
|
29
|
+
excludeEntities?: readonly IEntity[];
|
|
30
|
+
excludeColliders?: readonly PhysicsColliderQueryTarget[];
|
|
31
|
+
predicate?: (candidate: PhysicsQueryCandidate) => boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface PhysicsShapeCastOptions extends PhysicsRaycastOptions {
|
|
34
|
+
targetDistance?: number;
|
|
35
|
+
stopAtPenetration?: boolean;
|
|
36
|
+
}
|
|
37
|
+
/** @internal Fully resolved query settings passed to a backend strategy. */
|
|
38
|
+
export interface ResolvedPhysicsRaycastOptions {
|
|
39
|
+
includeSensors: boolean;
|
|
40
|
+
solid: boolean;
|
|
41
|
+
collisionGroup: number;
|
|
42
|
+
collisionMask: number;
|
|
43
|
+
excludeEntities: readonly IEntity[];
|
|
44
|
+
excludeColliders: readonly PhysicsColliderQueryTarget[];
|
|
45
|
+
predicate?: (candidate: PhysicsQueryCandidate) => boolean;
|
|
46
|
+
}
|
|
47
|
+
/** @internal Fully resolved shape-cast settings passed to a backend strategy. */
|
|
48
|
+
export interface ResolvedPhysicsShapeCastOptions extends ResolvedPhysicsRaycastOptions {
|
|
49
|
+
targetDistance: number;
|
|
50
|
+
stopAtPenetration: boolean;
|
|
51
|
+
}
|
|
52
|
+
export interface PhysicsWorldQueryStrategy {
|
|
53
|
+
castRay(origin: IVector3, normalizedDirection: IVector3, maxDistance: number, options: ResolvedPhysicsRaycastOptions): PhysicsRaycastHit | undefined;
|
|
54
|
+
castSphere(origin: IVector3, radius: number, normalizedDirection: IVector3, maxDistance: number, options: ResolvedPhysicsShapeCastOptions): PhysicsShapeCastHit | undefined;
|
|
55
|
+
}
|
|
56
|
+
/** Backend-neutral physics scene-query facade. */
|
|
57
|
+
export declare class PhysicsWorldQuery {
|
|
58
|
+
private readonly __strategy;
|
|
59
|
+
constructor(__strategy: PhysicsWorldQueryStrategy);
|
|
60
|
+
castRay(origin: IVector3, direction: IVector3, maxDistance: number, options?: PhysicsRaycastOptions): PhysicsRaycastHit | undefined;
|
|
61
|
+
castRaySegment(start: IVector3, end: IVector3, options?: PhysicsRaycastOptions): PhysicsRaycastHit | undefined;
|
|
62
|
+
castSphere(origin: IVector3, radius: number, direction: IVector3, maxDistance: number, options?: PhysicsShapeCastOptions): PhysicsShapeCastHit | undefined;
|
|
63
|
+
private static __assertFiniteVector;
|
|
64
|
+
private static __assertPositive;
|
|
65
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { ShapeInstance } from '../../geometry/Shape';
|
|
2
|
+
import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
3
|
+
import { type IVector3 } from '../../math';
|
|
4
|
+
import type { CharacterControllerOptions, CharacterControllerStrategy, CharacterGroundContact, CharacterMotionState } from '../CharacterControllerStrategy';
|
|
5
|
+
import { type RapierStepParticipant } from './RapierPhysicsStrategy';
|
|
6
|
+
/** Rapier-backed kinematic capsule character controller. */
|
|
7
|
+
export declare class RapierCharacterControllerStrategy implements CharacterControllerStrategy, RapierStepParticipant {
|
|
8
|
+
private __entity?;
|
|
9
|
+
private __rigidBody?;
|
|
10
|
+
private __collider?;
|
|
11
|
+
private __controller?;
|
|
12
|
+
private __options;
|
|
13
|
+
private __desiredHorizontalVelocity;
|
|
14
|
+
private __computedMovement;
|
|
15
|
+
private __verticalVelocity;
|
|
16
|
+
private __isGrounded;
|
|
17
|
+
private __jumpRequested;
|
|
18
|
+
private __enabled;
|
|
19
|
+
private __groundContact?;
|
|
20
|
+
private __capsuleBottomOffset;
|
|
21
|
+
private __worldQuery?;
|
|
22
|
+
private __stuckFrameCount;
|
|
23
|
+
private __isRecovering;
|
|
24
|
+
private __motionState;
|
|
25
|
+
private __lastStepDeltaTime;
|
|
26
|
+
private __wasGrounded;
|
|
27
|
+
private __hasEstablishedGrounding;
|
|
28
|
+
private __stateVerticalVelocity;
|
|
29
|
+
private __landingImpactSpeed;
|
|
30
|
+
private __shapeInstance?;
|
|
31
|
+
private __worldScale;
|
|
32
|
+
private __isGroundProbeRadiusDerived;
|
|
33
|
+
private __warnedNonUniformScale;
|
|
34
|
+
setup(entity: ISceneGraphEntity, shapeInstance: ShapeInstance, options?: CharacterControllerOptions): void;
|
|
35
|
+
setDesiredHorizontalVelocity(velocity: IVector3): void;
|
|
36
|
+
requestJump(): void;
|
|
37
|
+
teleport(position: IVector3): void;
|
|
38
|
+
preStep(deltaTime: number): void;
|
|
39
|
+
postStep(): void;
|
|
40
|
+
get isGrounded(): boolean;
|
|
41
|
+
get computedMovement(): IVector3;
|
|
42
|
+
get groundContact(): CharacterGroundContact | undefined;
|
|
43
|
+
get isRecovering(): boolean;
|
|
44
|
+
get motionState(): CharacterMotionState;
|
|
45
|
+
set enabled(value: boolean);
|
|
46
|
+
get enabled(): boolean;
|
|
47
|
+
destroy(): void;
|
|
48
|
+
private __resolveCharacterCapsule;
|
|
49
|
+
private __createCharacterColliderDesc;
|
|
50
|
+
private __synchronizeScale;
|
|
51
|
+
private __synchronizePosition;
|
|
52
|
+
private __updateMotionState;
|
|
53
|
+
private __resolveMovementState;
|
|
54
|
+
private __getCollisionNormals;
|
|
55
|
+
private __createNudgeMovement;
|
|
56
|
+
private __updateGroundContact;
|
|
57
|
+
private __validateOptions;
|
|
58
|
+
}
|
|
@@ -1,42 +1,115 @@
|
|
|
1
1
|
import type { Config } from '../../core/Config';
|
|
2
|
+
import type { ShapeInstance } from '../../geometry/Shape';
|
|
2
3
|
import type { ISceneGraphEntity } from '../../helpers';
|
|
3
4
|
import { type IQuaternion, type IVector3 } from '../../math';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
5
|
+
import type { Engine } from '../../system/Engine';
|
|
6
|
+
import type { PhysicsBodyProperty, PhysicsColliderProperty, PhysicsMotionProperty, PhysicsPropertyInner } from '../PhysicsProperty';
|
|
7
|
+
import type { PhysicsShapeInstanceBinding, PhysicsStrategy } from '../PhysicsStrategy';
|
|
6
8
|
import type { PhysicsWorldProperty } from '../PhysicsWorldProperty';
|
|
7
|
-
type RapierVector3Like = {
|
|
9
|
+
export type RapierVector3Like = {
|
|
8
10
|
x: number;
|
|
9
11
|
y: number;
|
|
10
12
|
z: number;
|
|
11
13
|
};
|
|
12
|
-
type RapierQuaternionLike = {
|
|
14
|
+
export type RapierQuaternionLike = {
|
|
13
15
|
x: number;
|
|
14
16
|
y: number;
|
|
15
17
|
z: number;
|
|
16
18
|
w: number;
|
|
17
19
|
};
|
|
18
|
-
type RapierRigidBodyDescLike = {
|
|
20
|
+
export type RapierRigidBodyDescLike = {
|
|
19
21
|
setTranslation(x: number, y: number, z: number): RapierRigidBodyDescLike;
|
|
20
22
|
setRotation(rotation: RapierQuaternionLike): RapierRigidBodyDescLike;
|
|
23
|
+
setLinvel?(x: number, y: number, z: number): RapierRigidBodyDescLike;
|
|
24
|
+
setAngvel?(velocity: RapierVector3Like): RapierRigidBodyDescLike;
|
|
25
|
+
setGravityScale?(factor: number): RapierRigidBodyDescLike;
|
|
21
26
|
};
|
|
22
|
-
type RapierColliderDescLike = {
|
|
27
|
+
export type RapierColliderDescLike = {
|
|
28
|
+
setTranslation?(x: number, y: number, z: number): RapierColliderDescLike;
|
|
29
|
+
setRotation?(rotation: RapierQuaternionLike): RapierColliderDescLike;
|
|
23
30
|
setDensity?(density: number): RapierColliderDescLike;
|
|
24
31
|
setFriction?(friction: number): RapierColliderDescLike;
|
|
25
32
|
setRestitution?(restitution: number): RapierColliderDescLike;
|
|
33
|
+
setCollisionGroups?(groups: number): RapierColliderDescLike;
|
|
34
|
+
setSensor?(sensor: boolean): RapierColliderDescLike;
|
|
35
|
+
setActiveEvents?(events: number): RapierColliderDescLike;
|
|
36
|
+
setActiveCollisionTypes?(types: number): RapierColliderDescLike;
|
|
26
37
|
};
|
|
27
|
-
type RapierRigidBodyLike = {
|
|
38
|
+
export type RapierRigidBodyLike = {
|
|
28
39
|
translation(): RapierVector3Like;
|
|
29
40
|
rotation(): RapierQuaternionLike;
|
|
41
|
+
linvel?(): RapierVector3Like;
|
|
42
|
+
angvel?(): RapierVector3Like;
|
|
30
43
|
setTranslation(translation: RapierVector3Like, wakeUp: boolean): void;
|
|
31
44
|
setRotation(rotation: RapierQuaternionLike, wakeUp: boolean): void;
|
|
45
|
+
setNextKinematicTranslation?(translation: RapierVector3Like): void;
|
|
46
|
+
setNextKinematicRotation?(rotation: RapierQuaternionLike): void;
|
|
47
|
+
mass?(): number;
|
|
48
|
+
localCom?(): RapierVector3Like;
|
|
49
|
+
principalInertia?(): RapierVector3Like;
|
|
50
|
+
principalInertiaLocalFrame?(): RapierQuaternionLike;
|
|
51
|
+
recomputeMassPropertiesFromColliders?(): void;
|
|
52
|
+
setAdditionalMassProperties?(mass: number, centerOfMass: RapierVector3Like, principalAngularInertia: RapierVector3Like, angularInertiaLocalFrame: RapierQuaternionLike, wakeUp: boolean): void;
|
|
32
53
|
};
|
|
33
|
-
type RapierColliderLike =
|
|
34
|
-
|
|
35
|
-
|
|
54
|
+
export type RapierColliderLike = {
|
|
55
|
+
handle?: number;
|
|
56
|
+
isSensor?(): boolean;
|
|
57
|
+
setDensity?(density: number): void;
|
|
58
|
+
};
|
|
59
|
+
export type RapierRayIntersectionLike = {
|
|
60
|
+
collider: RapierColliderLike;
|
|
61
|
+
timeOfImpact: number;
|
|
62
|
+
normal: RapierVector3Like;
|
|
63
|
+
};
|
|
64
|
+
export type RapierShapeCastHitLike = {
|
|
65
|
+
collider: RapierColliderLike;
|
|
66
|
+
time_of_impact: number;
|
|
67
|
+
normal1: RapierVector3Like;
|
|
68
|
+
witness1: RapierVector3Like;
|
|
69
|
+
normal2: RapierVector3Like;
|
|
70
|
+
witness2: RapierVector3Like;
|
|
71
|
+
};
|
|
72
|
+
export type RapierColliderMetadata = {
|
|
73
|
+
entity: ISceneGraphEntity;
|
|
74
|
+
bindingId?: number;
|
|
75
|
+
isSensor: boolean;
|
|
76
|
+
};
|
|
77
|
+
export type RapierCharacterControllerLike = {
|
|
78
|
+
enableAutostep(maxHeight: number, minWidth: number, includeDynamicBodies: boolean): void;
|
|
79
|
+
enableSnapToGround(distance: number): void;
|
|
80
|
+
setMaxSlopeClimbAngle(angle: number): void;
|
|
81
|
+
setMinSlopeSlideAngle(angle: number): void;
|
|
82
|
+
setApplyImpulsesToDynamicBodies(enabled: boolean): void;
|
|
83
|
+
setNormalNudgeFactor?(value: number): void;
|
|
84
|
+
computeColliderMovement(collider: RapierColliderLike, desiredTranslationDelta: RapierVector3Like, filterFlags?: number, filterGroups?: number, filterPredicate?: (collider: RapierColliderLike) => boolean): void;
|
|
85
|
+
computedMovement(): RapierVector3Like;
|
|
86
|
+
computedGrounded(): boolean;
|
|
87
|
+
numComputedCollisions?(): number;
|
|
88
|
+
computedCollision?(index: number): RapierCharacterCollisionLike | null;
|
|
89
|
+
};
|
|
90
|
+
export type RapierCharacterCollisionLike = {
|
|
91
|
+
normal1: RapierVector3Like;
|
|
92
|
+
};
|
|
93
|
+
export type RapierWorldLike = {
|
|
94
|
+
timestep: number;
|
|
95
|
+
free?(): void;
|
|
96
|
+
step(eventQueue?: RapierEventQueueLike): void;
|
|
36
97
|
createRigidBody(desc: RapierRigidBodyDescLike): RapierRigidBodyLike;
|
|
37
98
|
createCollider(desc: RapierColliderDescLike, rigidBody?: RapierRigidBodyLike): RapierColliderLike;
|
|
38
99
|
removeRigidBody?(rigidBody: RapierRigidBodyLike): void;
|
|
100
|
+
createCharacterController?(offset: number): RapierCharacterControllerLike;
|
|
101
|
+
removeCharacterController?(controller: RapierCharacterControllerLike): void;
|
|
102
|
+
castRayAndGetNormal?(ray: unknown, maxToi: number, solid: boolean, filterFlags?: number, filterGroups?: number, filterExcludeCollider?: RapierColliderLike, filterExcludeRigidBody?: RapierRigidBodyLike, filterPredicate?: (collider: RapierColliderLike) => boolean): RapierRayIntersectionLike | null;
|
|
103
|
+
castShape?(shapePos: RapierVector3Like, shapeRot: RapierQuaternionLike, shapeVel: RapierVector3Like, shape: unknown, targetDistance: number, maxToi: number, stopAtPenetration: boolean, filterFlags?: number, filterGroups?: number, filterExcludeCollider?: RapierColliderLike, filterExcludeRigidBody?: RapierRigidBodyLike, filterPredicate?: (collider: RapierColliderLike) => boolean): RapierShapeCastHitLike | null;
|
|
104
|
+
};
|
|
105
|
+
export type RapierEventQueueLike = {
|
|
106
|
+
drainCollisionEvents(callback: (handle1: number, handle2: number, started: boolean) => void): void;
|
|
107
|
+
free?(): void;
|
|
39
108
|
};
|
|
109
|
+
export interface RapierStepParticipant {
|
|
110
|
+
preStep(deltaTime: number): void;
|
|
111
|
+
postStep(): void;
|
|
112
|
+
}
|
|
40
113
|
export type RapierPhysicsModuleLike = {
|
|
41
114
|
default?: RapierPhysicsModuleLike;
|
|
42
115
|
init?: () => void | Promise<void>;
|
|
@@ -44,11 +117,26 @@ export type RapierPhysicsModuleLike = {
|
|
|
44
117
|
RigidBodyDesc: {
|
|
45
118
|
dynamic(): RapierRigidBodyDescLike;
|
|
46
119
|
fixed(): RapierRigidBodyDescLike;
|
|
120
|
+
kinematicPositionBased?(): RapierRigidBodyDescLike;
|
|
47
121
|
};
|
|
48
122
|
ColliderDesc: {
|
|
49
123
|
cuboid(x: number, y: number, z: number): RapierColliderDescLike;
|
|
50
124
|
ball(radius: number): RapierColliderDescLike;
|
|
125
|
+
capsule?(halfHeight: number, radius: number): RapierColliderDescLike;
|
|
126
|
+
cylinder?(halfHeight: number, radius: number): RapierColliderDescLike;
|
|
127
|
+
};
|
|
128
|
+
EventQueue?: new (autoDrain: boolean) => RapierEventQueueLike;
|
|
129
|
+
ActiveEvents?: {
|
|
130
|
+
COLLISION_EVENTS: number;
|
|
131
|
+
};
|
|
132
|
+
ActiveCollisionTypes?: {
|
|
133
|
+
ALL: number;
|
|
51
134
|
};
|
|
135
|
+
QueryFilterFlags?: {
|
|
136
|
+
EXCLUDE_SENSORS: number;
|
|
137
|
+
};
|
|
138
|
+
Ray?: new (origin: RapierVector3Like, direction: RapierVector3Like) => unknown;
|
|
139
|
+
Ball?: new (radius: number) => unknown;
|
|
52
140
|
};
|
|
53
141
|
/**
|
|
54
142
|
* Physics strategy implementation using externally provided Rapier.js bindings.
|
|
@@ -57,16 +145,29 @@ export type RapierPhysicsModuleLike = {
|
|
|
57
145
|
* RapierPhysicsStrategy.initialize(RAPIER) before creating this strategy.
|
|
58
146
|
*/
|
|
59
147
|
export declare class RapierPhysicsStrategy implements PhysicsStrategy {
|
|
148
|
+
private static readonly __defaultTimestep;
|
|
149
|
+
private static readonly __maxTimestep;
|
|
60
150
|
static __worldProperty: PhysicsWorldProperty;
|
|
61
151
|
private static __rapier?;
|
|
62
|
-
private static
|
|
152
|
+
private static __defaultWorldState?;
|
|
153
|
+
private static __worldStates;
|
|
154
|
+
private static __stepParticipants;
|
|
63
155
|
private __rigidBody?;
|
|
64
|
-
private
|
|
156
|
+
private __colliders;
|
|
65
157
|
private __entity?;
|
|
66
158
|
private __property?;
|
|
67
159
|
private __localScale;
|
|
160
|
+
private __shapeLocalPosition;
|
|
161
|
+
private __shapeLocalRotation;
|
|
162
|
+
private __shapeBindings?;
|
|
163
|
+
private __motion?;
|
|
164
|
+
private __shapeWorldScale;
|
|
165
|
+
private __shapeWorldSignedScale;
|
|
166
|
+
private __warnedAsymmetricRadius;
|
|
167
|
+
private __warnedNonUniformScale;
|
|
168
|
+
private __warnedShearedBoxApproximation;
|
|
68
169
|
/**
|
|
69
|
-
* Injects Rapier.js bindings
|
|
170
|
+
* Injects Rapier.js bindings. Physics worlds are created lazily per Engine.
|
|
70
171
|
* @param rapierModule - Rapier module or compat module default export
|
|
71
172
|
* @param worldProperty - Optional world settings
|
|
72
173
|
*/
|
|
@@ -81,7 +182,11 @@ export declare class RapierPhysicsStrategy implements PhysicsStrategy {
|
|
|
81
182
|
* @param prop - Physics properties defining shape and material values
|
|
82
183
|
* @param entity - Scene graph entity associated with the physics body
|
|
83
184
|
*/
|
|
84
|
-
setShape(prop: PhysicsPropertyInner, entity: ISceneGraphEntity): void;
|
|
185
|
+
setShape(prop: PhysicsPropertyInner, entity: ISceneGraphEntity, worldScale?: IVector3): void;
|
|
186
|
+
setShapeInstance(shape: ShapeInstance, body: PhysicsBodyProperty, collider: PhysicsColliderProperty, entity: ISceneGraphEntity, worldScale?: IVector3, motion?: PhysicsMotionProperty): void;
|
|
187
|
+
setShapeInstances(bindings: readonly PhysicsShapeInstanceBinding[], entity: ISceneGraphEntity, worldScale?: IVector3, motion?: PhysicsMotionProperty): void;
|
|
188
|
+
clearShapeInstances(): void;
|
|
189
|
+
private __setShape;
|
|
85
190
|
/**
|
|
86
191
|
* Updates the associated entity transform from the Rapier body state.
|
|
87
192
|
*/
|
|
@@ -106,17 +211,50 @@ export declare class RapierPhysicsStrategy implements PhysicsStrategy {
|
|
|
106
211
|
* @param worldScale - World scale
|
|
107
212
|
*/
|
|
108
213
|
setScale(worldScale: IVector3): void;
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
static update(): void;
|
|
214
|
+
private __createScaledSize;
|
|
215
|
+
private __isValidSize;
|
|
216
|
+
/** Advances one Engine's Rapier world, or every initialized Engine world when omitted. */
|
|
217
|
+
static update(frameId?: number, deltaTime?: number, engine?: Engine): void;
|
|
218
|
+
/** @internal Registers colliders created outside PhysicsComponent, such as a character controller. */
|
|
219
|
+
static _registerExternalCollider(collider: RapierColliderLike, entity: ISceneGraphEntity): void;
|
|
220
|
+
/** @internal */
|
|
221
|
+
static _unregisterExternalCollider(collider: RapierColliderLike | undefined, engine?: Engine, isRebuilding?: boolean): void;
|
|
222
|
+
private static __unregisterColliderMetadata;
|
|
223
|
+
private static __drainCollisionEvents;
|
|
224
|
+
/** @internal */
|
|
225
|
+
static _registerStepParticipant(participant: RapierStepParticipant, engine: Engine): void;
|
|
226
|
+
/** @internal */
|
|
227
|
+
static _unregisterStepParticipant(participant: RapierStepParticipant): void;
|
|
228
|
+
/** @internal Releases the Rapier world owned by a destroyed Engine. */
|
|
229
|
+
static _cleanupForEngine(engine: Engine): void;
|
|
230
|
+
/** @internal */
|
|
231
|
+
static _getRapier(): RapierPhysicsModuleLike;
|
|
232
|
+
/** @internal */
|
|
233
|
+
static _getWorld(engine?: Engine): RapierWorldLike;
|
|
234
|
+
/** @internal */
|
|
235
|
+
static _getColliderMetadata(collider: RapierColliderLike, engine?: Engine): RapierColliderMetadata | undefined;
|
|
236
|
+
/** @internal */
|
|
237
|
+
static _packCollisionGroups(group: number, mask: number): number;
|
|
113
238
|
private __createBody;
|
|
239
|
+
private __isKinematicBody;
|
|
240
|
+
private __captureDynamicBodyState;
|
|
241
|
+
private __applyCompleteMassProperties;
|
|
114
242
|
private __createColliderDesc;
|
|
243
|
+
private __createShapeInstanceColliderDesc;
|
|
244
|
+
private static __packCollisionGroups;
|
|
245
|
+
private __getScaledVolume;
|
|
246
|
+
private __resolveBoxCollider;
|
|
247
|
+
private static __copyMotion;
|
|
248
|
+
private __getApproximatedRadius;
|
|
249
|
+
private __warnNonUniformScaleIfNeeded;
|
|
115
250
|
private __removeBody;
|
|
251
|
+
private static __validateShapeSupport;
|
|
116
252
|
private static __assertInitialized;
|
|
117
253
|
private static __getRapier;
|
|
118
254
|
private static __getWorld;
|
|
255
|
+
private static __getWorldState;
|
|
256
|
+
private static __createWorldState;
|
|
257
|
+
private static __disposeWorldState;
|
|
119
258
|
private static __eulerToQuaternion;
|
|
120
259
|
private static __toRapierQuaternion;
|
|
121
260
|
}
|
|
122
|
-
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type IVector3 } from '../../math';
|
|
2
|
+
import type { Engine } from '../../system/Engine';
|
|
3
|
+
import type { PhysicsRaycastHit, PhysicsShapeCastHit, PhysicsWorldQueryStrategy, ResolvedPhysicsRaycastOptions, ResolvedPhysicsShapeCastOptions } from '../PhysicsWorldQuery';
|
|
4
|
+
/** Physics scene queries backed by one Engine's Rapier world. */
|
|
5
|
+
export declare class RapierPhysicsWorldQueryStrategy implements PhysicsWorldQueryStrategy {
|
|
6
|
+
private readonly __engine?;
|
|
7
|
+
constructor(__engine?: Engine | undefined);
|
|
8
|
+
castRay(origin: IVector3, normalizedDirection: IVector3, maxDistance: number, options: ResolvedPhysicsRaycastOptions): PhysicsRaycastHit | undefined;
|
|
9
|
+
castSphere(origin: IVector3, radius: number, normalizedDirection: IVector3, maxDistance: number, options: ResolvedPhysicsShapeCastOptions): PhysicsShapeCastHit | undefined;
|
|
10
|
+
private __createPredicate;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IQuaternion } from '../math/IQuaternion';
|
|
2
|
+
import type { IVector3 } from '../math/IVector';
|
|
3
|
+
export type ResolvedBoxTransform = {
|
|
4
|
+
halfExtents: IVector3;
|
|
5
|
+
rotation: IQuaternion;
|
|
6
|
+
approximated: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type ResolvedAxialTransform = {
|
|
9
|
+
halfHeight: number;
|
|
10
|
+
radius: number;
|
|
11
|
+
rotation: IQuaternion;
|
|
12
|
+
approximated: boolean;
|
|
13
|
+
};
|
|
14
|
+
/** Resolves S * R for a box, falling back to a conservative entity-local AABB when it contains shear. */
|
|
15
|
+
export declare function resolveScaledBox(size: IVector3, localRotation: IQuaternion, scale: IVector3): ResolvedBoxTransform;
|
|
16
|
+
/** Resolves a scaled cylinder to a containing circular cylinder aligned with its transformed local Y axis. */
|
|
17
|
+
export declare function resolveScaledCylinder(height: number, radius: number, localRotation: IQuaternion, scale: IVector3): ResolvedAxialTransform;
|
|
18
|
+
/** Resolves a scaled capsule using its transformed segment and a sphere containing the scaled end caps. */
|
|
19
|
+
export declare function resolveScaledCapsule(height: number, radius: number, localRotation: IQuaternion, scale: IVector3): ResolvedAxialTransform;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export * from './CharacterControllerStrategy';
|
|
1
2
|
export * from './Oimo';
|
|
2
3
|
export * from './PhysicsProperty';
|
|
3
4
|
export * from './PhysicsStrategy';
|
|
4
5
|
export * from './PhysicsWorldProperty';
|
|
6
|
+
export * from './PhysicsWorldQuery';
|
|
5
7
|
export * from './Rapier';
|
|
6
8
|
export * from './VRMSpring';
|