Fix #120: Resolve global position of seated avatars for accurate Nearme radar tracking
This commit is contained in:
parent
9c5274d656
commit
176b9d059f
2 changed files with 13 additions and 7 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenMetaverse;
|
using OpenMetaverse;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
|
@ -83,14 +83,20 @@ namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
if (av.ID != GetClient().Self.AgentID)
|
if (av.ID != GetClient().Self.AgentID)
|
||||||
{
|
{
|
||||||
|
Vector3 globalPos = av.Position;
|
||||||
|
if (av.ParentID != 0 && GetClient().Network.CurrentSim.ObjectsPrimitives.TryGetValue(av.ParentID, out Primitive parentObj))
|
||||||
|
{
|
||||||
|
globalPos = parentObj.Position + (av.Position * parentObj.Rotation);
|
||||||
|
}
|
||||||
|
|
||||||
NearMeDetails details = new()
|
NearMeDetails details = new()
|
||||||
{
|
{
|
||||||
id = av.ID.ToString(),
|
id = av.ID.ToString(),
|
||||||
name = av.Name,
|
name = av.Name,
|
||||||
x = (int)Math.Round(av.Position.X),
|
x = (int)Math.Round(globalPos.X),
|
||||||
y = (int)Math.Round(av.Position.Y),
|
y = (int)Math.Round(globalPos.Y),
|
||||||
z = (int)Math.Round(av.Position.Z),
|
z = (int)Math.Round(globalPos.Z),
|
||||||
range = (int)Math.Round(Vector3.Distance(av.Position, GetClient().Self.SimPosition))
|
range = Math.Round(Vector3.Distance(globalPos, GetClient().Self.SimPosition), 2)
|
||||||
};
|
};
|
||||||
BetterNearMe.Add(details);
|
BetterNearMe.Add(details);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
using SecondBotEvents.Services;
|
using SecondBotEvents.Services;
|
||||||
|
|
||||||
namespace SecondBotEvents.Commands
|
namespace SecondBotEvents.Commands
|
||||||
{
|
{
|
||||||
|
|
@ -28,7 +28,7 @@ namespace SecondBotEvents.Commands
|
||||||
public int x { get; set; }
|
public int x { get; set; }
|
||||||
public int y { get; set; }
|
public int y { get; set; }
|
||||||
public int z { get; set; }
|
public int z { get; set; }
|
||||||
public int range { get; set; }
|
public double range { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue