@drawcall/acta 0.1.8 → 0.1.9
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/dist/behavior.d.ts +1 -0
- package/dist/behavior.js +11 -2
- package/dist/types.js +1 -1
- package/package.json +1 -1
package/dist/behavior.d.ts
CHANGED
|
@@ -52,6 +52,7 @@ export declare class CharacterBehavior extends EventDispatcher<CharacterBehavior
|
|
|
52
52
|
private currentBodyYaw;
|
|
53
53
|
private readonly currentSpineQuat;
|
|
54
54
|
private readonly currentNeckEuler;
|
|
55
|
+
private speedMultiplier;
|
|
55
56
|
constructor(behavior: Behavior, animationUrls: Record<string, string>, audioUrls: Record<string, string>, model: CharacterModel, applyMove?: ((worldMoveVelocity: Vector3, delta: number) => void) | undefined, applyJump?: (() => void) | undefined, loadingManager?: LoadingManager);
|
|
56
57
|
private init;
|
|
57
58
|
private loadMoveAnimations;
|
package/dist/behavior.js
CHANGED
|
@@ -5,7 +5,6 @@ import { makeClipAdditive } from 'three/src/animation/AnimationUtils.js';
|
|
|
5
5
|
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
|
|
6
6
|
import { VRM } from '@pixiv/three-vrm';
|
|
7
7
|
import { clamp } from 'three/src/math/MathUtils.js';
|
|
8
|
-
const ZeroVector = new Vector3();
|
|
9
8
|
const ForwardVector = new Vector3(0, 0, 1);
|
|
10
9
|
const UpVector = new Vector3(0, 1, 0);
|
|
11
10
|
const SpineAimYawOffset = -0.5;
|
|
@@ -56,6 +55,7 @@ export class CharacterBehavior extends EventDispatcher {
|
|
|
56
55
|
currentBodyYaw = 0;
|
|
57
56
|
currentSpineQuat = new Quaternion();
|
|
58
57
|
currentNeckEuler = new Euler(0, 0, 0, 'YXZ');
|
|
58
|
+
speedMultiplier = 1;
|
|
59
59
|
constructor(behavior, animationUrls, audioUrls, model, applyMove, applyJump, loadingManager) {
|
|
60
60
|
super();
|
|
61
61
|
this.model = model;
|
|
@@ -183,7 +183,9 @@ export class CharacterBehavior extends EventDispatcher {
|
|
|
183
183
|
this.currentNeckEuler.z = 0;
|
|
184
184
|
neckBone.rotation.copy(this.currentNeckEuler);
|
|
185
185
|
}
|
|
186
|
-
this.applyMove?.(this.moveStatus === 'none'
|
|
186
|
+
this.applyMove?.(this.moveStatus === 'none'
|
|
187
|
+
? vectorHelper.set(0, 0, 0)
|
|
188
|
+
: vectorHelper.copy(this.worldMoveVelocity).multiplyScalar(this.speedMultiplier), delta);
|
|
187
189
|
}
|
|
188
190
|
destroy() {
|
|
189
191
|
this.abortController.abort();
|
|
@@ -356,6 +358,12 @@ export class CharacterBehavior extends EventDispatcher {
|
|
|
356
358
|
until: name === 'Jump_Land' ? timePassed(150, 'milliseconds') : animationFinished(animationAction),
|
|
357
359
|
update: name === 'Jump_Start'
|
|
358
360
|
? (_, _clock, actionTime) => {
|
|
361
|
+
if (actionTime <= 0.2) {
|
|
362
|
+
self.speedMultiplier = 0.2;
|
|
363
|
+
}
|
|
364
|
+
else {
|
|
365
|
+
self.speedMultiplier = 1;
|
|
366
|
+
}
|
|
359
367
|
if (actionTime > 0.2 && animationAction.paused) {
|
|
360
368
|
animationAction.paused = false;
|
|
361
369
|
self.applyJump?.();
|
|
@@ -369,6 +377,7 @@ export class CharacterBehavior extends EventDispatcher {
|
|
|
369
377
|
});
|
|
370
378
|
}
|
|
371
379
|
finally {
|
|
380
|
+
self.speedMultiplier = 1;
|
|
372
381
|
if ((name === 'Jump_Loop' || name === 'Jump_Start' || name === 'Jump_Land') && mask != 'upperbody') {
|
|
373
382
|
self.moveStatus = 'none';
|
|
374
383
|
}
|
package/dist/types.js
CHANGED
|
@@ -8,7 +8,7 @@ export function getProperties(behavior) {
|
|
|
8
8
|
function collectFromCondition(condition) {
|
|
9
9
|
switch (condition.type) {
|
|
10
10
|
case 'isTrue':
|
|
11
|
-
if (condition.property != 'isMoving'
|
|
11
|
+
if (condition.property != 'isMoving') {
|
|
12
12
|
properties.add(condition.property);
|
|
13
13
|
}
|
|
14
14
|
break;
|