|
@@ -99,7 +99,7 @@ export default class Charactor {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- async walkByPath(charactorManager) {
|
|
|
+ walkByPath(charactorManager) {
|
|
|
|
|
|
let charactor = this
|
|
|
|
|
@@ -133,10 +133,10 @@ export default class Charactor {
|
|
|
let walkDirc = newPos.subtract(startingPoint).normalize();
|
|
|
|
|
|
// 行走动画
|
|
|
- const walkAni = new BABYLON.Animation("walk", "position", charactorManager.frameRate,
|
|
|
+ const walkAni = new BABYLON.Animation("walk", "position", settings.video.frameRate,
|
|
|
BABYLON.Animation.ANIMATIONTYPE_VECTOR3, BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE);
|
|
|
|
|
|
- let walkFrameNum = charactorManager.frameRate * video.duration
|
|
|
+ let walkFrameNum = settings.video.frameRate * video.duration / (charactorManager.app.currentPoints.length-1)
|
|
|
const walkKeyFrames = [{
|
|
|
frame: 0,
|
|
|
value: charactor.mesh.position
|
|
@@ -150,10 +150,10 @@ export default class Charactor {
|
|
|
|
|
|
// 转身动画
|
|
|
const newQuar = BABYLON.Quaternion.FromUnitVectorsToRef(new BABYLON.Vector3(0, 0, 1), walkDirc, new BABYLON.Quaternion())
|
|
|
- const turnAroundAni = new BABYLON.Animation("turnAround", "rotationQuaternion", charactorManager.frameRate,
|
|
|
+ const turnAroundAni = new BABYLON.Animation("turnAround", "rotationQuaternion", settings.video.frameRate,
|
|
|
BABYLON.Animation.ANIMATIONTYPE_QUATERNION, BABYLON.Animation.ANIMATIONLOOPMODE_RELATIVE);
|
|
|
|
|
|
- let turnAroundFrameNum = charactorManager.frameRate * 0.2 // 0.2秒的帧数
|
|
|
+ let turnAroundFrameNum = settings.video.frameRate * 0.2 // 0.2秒的帧数
|
|
|
const turnAroundFrames = [{
|
|
|
frame: 0,
|
|
|
value: charactor.mesh.rotationQuaternion
|
|
@@ -164,7 +164,6 @@ export default class Charactor {
|
|
|
|
|
|
turnAroundAni.setKeys(turnAroundFrames);
|
|
|
|
|
|
-
|
|
|
charactorManager.app.scene.beginDirectAnimation(charactor.mesh, [walkAni, turnAroundAni], 0, Math.max(walkFrameNum, turnAroundFrameNum), false, 1,
|
|
|
() => {
|
|
|
// 如果还有下一个点位就继续走,否则变为站立
|