PathfindLocalPositionMessage: local position is relative to nodemap

This commit is contained in:
JohnCorby 2022-04-09 14:20:36 -07:00
parent eddd4413a9
commit 6cb00269fc

View File

@ -1,14 +1,8 @@
using GhostEnums;
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
using QSB.EchoesOfTheEye.Ghosts.WorldObjects;
using QSB.Messaging;
using QSB.SectorSync.WorldObjects;
using QSB.Utility;
using QSB.WorldSync;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace QSB.EchoesOfTheEye.Ghosts.Messages;
@ -35,14 +29,14 @@ internal class PathfindLocalPositionMessage : QSBWorldObjectMessage<QSBGhostCont
{
if (QSBCore.IsHost)
{
DebugLog.ToConsole($"Error - Received PathfindLocalPositionMessage on host. Something has gone horribly wrong!", OWML.Common.MessageType.Error);
DebugLog.ToConsole("Error - Received PathfindLocalPositionMessage on host. Something has gone horribly wrong!", OWML.Common.MessageType.Error);
return;
}
var sector = QSBWorldSync.GetWorldObject<QSBSector>(Data.sectorId);
var sector = Data.sectorId.GetWorldObject<QSBSector>();
var worldPos = sector.AttachedObject.transform.TransformPoint(Data.localPosition);
DebugLog.DebugWrite($"{WorldObject.AttachedObject.name} Pathfind to local position {WorldObject.AttachedObject.transform.InverseTransformPoint(worldPos)} with speed:{Data.speed}, acceleration:{Data.acceleration}");
WorldObject.AttachedObject.PathfindToLocalPosition(WorldObject.AttachedObject.transform.InverseTransformPoint(worldPos), Data.speed, Data.acceleration);
WorldObject.AttachedObject.PathfindToLocalPosition(WorldObject.AttachedObject.WorldToLocalPosition(worldPos), Data.speed, Data.acceleration);
}
}