Purges uses of TransformComponent.WorldMatrix and TransformComponent.InvWorldMatrix (#34944)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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?
|
||||
|
||||
Reference in New Issue
Block a user