Purges uses of TransformComponent.WorldMatrix and TransformComponent.InvWorldMatrix (#34944)

This commit is contained in:
TemporalOroboros
2025-02-11 02:06:43 -08:00
committed by GitHub
parent 5eceaf3e33
commit dc67a5a0ba
8 changed files with 20 additions and 18 deletions

View File

@@ -73,13 +73,14 @@ public sealed class ExplosionGridTileFlood : ExplosionTileFlood
var transformSystem = entityManager.System<SharedTransformSystem>();
var transform = entityManager.GetComponent<TransformComponent>(Grid.Owner);
var size = (float) Grid.TileSize;
var size = (float)Grid.TileSize;
_matrix.M31 = size / 2;
_matrix.M32 = size / 2;
Matrix3x2.Invert(spaceMatrix, out var invSpace);
_matrix *= transform.WorldMatrix * invSpace;
var relativeAngle = transformSystem.GetWorldRotation(transform) - spaceAngle;
var (_, relativeAngle, worldMatrix) = transformSystem.GetWorldPositionRotationMatrix(transform);
relativeAngle -= spaceAngle;
_matrix *= worldMatrix * invSpace;
_offset = relativeAngle.RotateVec(new Vector2(size / 4, size / 4));
}

View File

@@ -71,8 +71,7 @@ public sealed partial class ExplosionSystem
{
var targetGrid = Comp<MapGridComponent>(referenceGrid.Value);
var xform = Transform(referenceGrid.Value);
targetAngle = _transformSystem.GetWorldRotation(xform);
targetMatrix = xform.InvWorldMatrix;
(_, targetAngle, targetMatrix) = _transformSystem.GetWorldPositionRotationInvMatrix(xform);
tileSize = targetGrid.TileSize;
}

View File

@@ -89,8 +89,7 @@ public sealed partial class ExplosionSystem
if (referenceGrid != null)
{
var xform = Transform(Comp<MapGridComponent>(referenceGrid.Value).Owner);
spaceMatrix = xform.WorldMatrix;
spaceAngle = _transformSystem.GetWorldRotation(xform);
(_, spaceAngle, spaceMatrix) = _transformSystem.GetWorldPositionRotationMatrix(xform);
}
// is the explosion starting on a grid?