@pmndrs/viverse 0.2.14 → 0.2.16
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.
|
@@ -25,3 +25,4 @@ export declare function flattenCharacterAnimationOptions(options: Exclude<Charac
|
|
|
25
25
|
export declare function loadCharacterAnimation(model: CharacterModel, url: string | DefaultUrl, type?: CharacterAnimationOptions['type'], removeXZMovement?: boolean, trimStartTime?: number | undefined, trimEndTime?: number | undefined, boneMap?: Record<string, VRMHumanBoneName> | undefined, scaleTime?: number | undefined, mask?: CharacterAnimationMask): Promise<AnimationClip>;
|
|
26
26
|
export declare const mixamoBoneMap: Record<string, VRMHumanBoneName>;
|
|
27
27
|
export declare const bvhBoneMap: Record<string, VRMHumanBoneName>;
|
|
28
|
+
export declare const allBoneNames: string[];
|
package/dist/animation/index.js
CHANGED
|
@@ -25,10 +25,13 @@ const nonVrmRotationOffset = new Quaternion().setFromEuler(new Euler(0, Math.PI,
|
|
|
25
25
|
//TODO: currently assumes the model is not yet transformed - loaded for the first time
|
|
26
26
|
export function fixModelAnimationClip(model, clip, clipScene, removeXZMovement) {
|
|
27
27
|
clip.tracks = clip.tracks.filter((track) => {
|
|
28
|
+
const [clipBoneName, propertyName] = track.name.split('.');
|
|
29
|
+
if (!allBoneNames.includes(clipBoneName)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
28
32
|
if (track instanceof QuaternionKeyframeTrack) {
|
|
29
33
|
return true;
|
|
30
34
|
}
|
|
31
|
-
const [clipBoneName, propertyName] = track.name.split('.');
|
|
32
35
|
if (propertyName != 'position') {
|
|
33
36
|
return false;
|
|
34
37
|
}
|
|
@@ -279,3 +282,4 @@ export async function loadCharacterAnimation(model, url, type, removeXZMovement
|
|
|
279
282
|
}
|
|
280
283
|
export const mixamoBoneMap = _mixamoBoneMap;
|
|
281
284
|
export const bvhBoneMap = _bvhBoneMap;
|
|
285
|
+
export const allBoneNames = Object.values(_mixamoBoneMap);
|
package/dist/physics/world.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Box3, Object3D, Ray, Vector3 } from 'three';
|
|
1
|
+
import { Box3, Intersection, Object3D, Ray, Vector3 } from 'three';
|
|
2
2
|
import { ExtendedTriangle } from 'three-mesh-bvh';
|
|
3
3
|
export declare class BvhPhysicsWorld {
|
|
4
4
|
private bodies;
|
|
@@ -16,5 +16,5 @@ export declare class BvhPhysicsWorld {
|
|
|
16
16
|
updateSensors(playerCenter: Vector3, intersectsBounds: (box: Box3) => boolean, intersectsTriangle: (triangle: ExtendedTriangle) => boolean): void;
|
|
17
17
|
shapecast(intersectsBounds: (box: Box3) => boolean, intersectsTriangle: (triangle: ExtendedTriangle) => void): void;
|
|
18
18
|
private shapecastEntry;
|
|
19
|
-
raycast(ray: Ray, far: number):
|
|
19
|
+
raycast(ray: Ray, far: number): Intersection<Object3D<import("three").Object3DEventMap>> | undefined;
|
|
20
20
|
}
|
package/dist/physics/world.js
CHANGED
|
@@ -130,10 +130,10 @@ export class BvhPhysicsWorld {
|
|
|
130
130
|
farHelper = farPointHelper.distanceTo(rayHelper.origin);
|
|
131
131
|
}
|
|
132
132
|
for (const intersection of entry.bvh.raycast(rayHelper, undefined, 0, farHelper)) {
|
|
133
|
-
if (result != null && intersection.distance >= result) {
|
|
133
|
+
if (result != null && intersection.distance >= result.distance) {
|
|
134
134
|
continue;
|
|
135
135
|
}
|
|
136
|
-
result = intersection
|
|
136
|
+
result = intersection;
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
return result;
|
|
@@ -93,7 +93,7 @@ export class SimpleCharacter extends Group {
|
|
|
93
93
|
this.model.update(delta);
|
|
94
94
|
}
|
|
95
95
|
this.physics.update(this, delta, this.options.physics);
|
|
96
|
-
this.cameraBehavior.update(this.camera, this, delta, this.world.raycast
|
|
96
|
+
this.cameraBehavior.update(this.camera, this, delta, (ray, far) => this.world.raycast(ray, far)?.distance, this.options.cameraBehavior);
|
|
97
97
|
}
|
|
98
98
|
dispose() {
|
|
99
99
|
this.abortController.abort();
|