|
@@ -81,11 +81,12 @@ export default class Charactor {
|
|
|
|
|
|
this.walkData = {
|
|
|
pathArr: pathArr,
|
|
|
- currentPoint: 0
|
|
|
+ currentPoint: -1
|
|
|
}
|
|
|
|
|
|
if(pathArr.length >= 2 && this.actionType.split("-")[1] != "Walking")
|
|
|
{
|
|
|
+ this.walkData.currentPoint = 0
|
|
|
let video = pathArr[0].video
|
|
|
if(video.isLoaded) {
|
|
|
this.AniTransfromTo("Walking")
|
|
@@ -108,37 +109,35 @@ export default class Charactor {
|
|
|
// 更新房间的视频贴图
|
|
|
let video = pathArr[currentPoint].video
|
|
|
charactorManager.app.updateHouseVideo(video)
|
|
|
-
|
|
|
let nextPos = pathArr[currentPoint+1].point
|
|
|
- let nextVideo = pathArr[currentPoint+1].video
|
|
|
+ // console.error(pathArr, video)
|
|
|
|
|
|
- if(!nextVideo)
|
|
|
- {
|
|
|
- // 即将走到终点之前,获取终点旋转视频
|
|
|
- let endPointId = pathArr[currentPoint+1].id
|
|
|
-
|
|
|
- console.log("[3D] send(getRotateVideoUrl): ", endPointId + "/" + endPointId)
|
|
|
- window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
- videoPath: endPointId + "/" + endPointId,
|
|
|
- sceneCode: settings.sceneCode,
|
|
|
- roomId: settings.roomId,
|
|
|
- userId: settings.userId,
|
|
|
- });
|
|
|
- window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
- videoPath: endPointId + "/" + endPointId + "_rotate",
|
|
|
- sceneCode: settings.sceneCode,
|
|
|
- roomId: settings.roomId,
|
|
|
- userId: settings.userId,
|
|
|
- });
|
|
|
|
|
|
- }
|
|
|
+ // 立即获取下一个点的旋转视频,防止中途旋转导致行走停止
|
|
|
+ let endPointId = pathArr[currentPoint+1].id
|
|
|
+
|
|
|
+ console.log("[3D] send(getRotateVideoUrl): ", endPointId + "/" + endPointId)
|
|
|
+ window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
+ videoPath: endPointId + "/" + endPointId,
|
|
|
+ sceneCode: settings.sceneCode,
|
|
|
+ roomId: settings.roomId,
|
|
|
+ userId: settings.userId,
|
|
|
+ });
|
|
|
+ window.connection.socket.emit("getRotateVideoUrl", {
|
|
|
+ videoPath: endPointId + "/" + endPointId + "_rotate",
|
|
|
+ sceneCode: settings.sceneCode,
|
|
|
+ roomId: settings.roomId,
|
|
|
+ userId: settings.userId,
|
|
|
+ });
|
|
|
+
|
|
|
|
|
|
// 要跳转的位置与当前位置相同的话,就直接跳过,否则动画会出bug
|
|
|
if(nextPos.x == this.mesh.position.x && nextPos.z == this.mesh.position.z)
|
|
|
{
|
|
|
console.warn("跳转点位与当前点位相同, 已跳过!")
|
|
|
|
|
|
- if(pathArr[currentPoint+1].video) {
|
|
|
+ let nextPointData = charactor.walkData.pathArr[++charactor.walkData.currentPoint]
|
|
|
+ if(nextPointData && nextPointData.video) {
|
|
|
charactor.walkByPath(charactorManager)
|
|
|
} else {
|
|
|
charactor.AniTransfromTo("Idle")
|
|
@@ -188,7 +187,8 @@ export default class Charactor {
|
|
|
charactorManager.app.scene.beginDirectAnimation(charactor.mesh, [walkAni, turnAroundAni], 0, Math.max(walkFrameNum, turnAroundFrameNum), false, 1,
|
|
|
() => {
|
|
|
// 如果还有下一个点位就继续走,否则变为站立
|
|
|
- if(pathArr[++charactor.walkData.currentPoint].video) {
|
|
|
+ let nextPointData = charactor.walkData.pathArr[++charactor.walkData.currentPoint]
|
|
|
+ if(nextPointData && nextPointData.video) {
|
|
|
charactor.walkByPath(charactorManager)
|
|
|
} else {
|
|
|
charactor.AniTransfromTo("Idle")
|