teleport at computed position

This commit is contained in:
4sval 2023-01-09 20:08:12 +01:00
parent 835d5f9d40
commit c596f85c55
2 changed files with 4 additions and 4 deletions

View File

@ -36,13 +36,13 @@ public class Camera
}
public void Setup(FBox box) => Teleport(FVector.ZeroVector, box, true);
public void Teleport(FVector instancePos, FBox box, bool updateAll = false)
public void Teleport(Vector3 instancePos, FBox box, bool updateAll = false)
{
box.GetCenterAndExtents(out var center, out var extents);
center += instancePos;
center += new FVector(instancePos.X, instancePos.Z, instancePos.Y);
var distance = extents.AbsMax();
Position = new Vector3(instancePos.X, center.Z, instancePos.Y + distance * 2);
Position = new Vector3(instancePos.X, center.Z, instancePos.Z + distance * 2);
Direction = new Vector3(center.X, center.Z, center.Y);
if (updateAll)
{

View File

@ -351,7 +351,7 @@ Snooper aims to give an accurate preview of models, materials, skeletal animatio
ImGui.EndDisabled();
if (ImGui.Selectable("Teleport To"))
{
var instancePos = model.Transforms[model.SelectedInstance].Position;
var instancePos = model.Transforms[model.SelectedInstance].Matrix.Translation;
s.Renderer.CameraOp.Teleport(instancePos, model.Box);
}