var inRange = true;
MapCoordinates originPos = default;
var targetPos = _transform.ToMapCoordinates(otherCoordinates);
- Angle targetRot = default;
+ Angle targetRot = _transform.GetWorldRotation(otherCoordinates.EntityId) + otherAngle;
// So essentially:
// 1. If fixtures available check nearest point. We take in coordinates / angles because we might want to use a lag compensated position
{
var (worldPosA, worldRotA) = _transform.GetWorldPositionRotation(origin.Comp);
var xfA = new Transform(worldPosA, worldRotA);
- var parentRotB = _transform.GetWorldRotation(otherCoordinates.EntityId);
- var xfB = new Transform(targetPos.Position, parentRotB + otherAngle);
+ var xfB = new Transform(targetPos.Position, targetRot);
// Different map or the likes.
if (!_broadphase.TryGetNearest(
else
{
originPos = _transform.GetMapCoordinates(origin, origin);
- var otherParent = (other.Comp ?? Transform(other)).ParentUid;
- targetRot = otherParent.IsValid() ? Transform(otherParent).LocalRotation + otherAngle : otherAngle;
}
// Do a raycast to check if relevant
/// if the target entity is a wallmount we ignore all other entities on the tile.
/// </example>
private Ignored GetPredicate(
- MapCoordinates origin,
+ MapCoordinates originCoords,
EntityUid target,
MapCoordinates targetCoords,
Angle targetRotation,
if (target == otherEnt ||
!_physicsQuery.TryComp(otherEnt, out var otherBody) ||
!otherBody.CanCollide ||
- ((int) collisionMask & otherBody.CollisionLayer) == 0x0)
+ ((int)collisionMask & otherBody.CollisionLayer) == 0x0)
{
continue;
}
ignoreAnchored = true;
else
{
- var angle = Angle.FromWorldVec(origin.Position - targetCoords.Position);
+ var angle = Angle.FromWorldVec(originCoords.Position - targetCoords.Position);
var angleDelta = (wallMount.Direction + targetRotation - angle).Reduced().FlipPositive();
ignoreAnchored = angleDelta < wallMount.Arc / 2 || Math.Tau - angleDelta < wallMount.Arc / 2;
}