Skip to content

Commit

Permalink
teleport at computed position
Browse files Browse the repository at this point in the history
  • Loading branch information
4sval committed Jan 9, 2023
1 parent 835d5f9 commit c596f85
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions FModel/Views/Snooper/Camera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ public 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)
{
Expand Down
2 changes: 1 addition & 1 deletion FModel/Views/Snooper/SnimGui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ private void DrawOuliner(Snooper s)
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);
}
Expand Down

0 comments on commit c596f85

Please sign in to comment.