foreach (var ent in _shadows)
{
var xform = _entManager.GetComponent<TransformComponent>(ent.Owner);
- var worldMatrix = _xformSys.GetWorldMatrix(xform);
+ var (worldPos, worldRot) = _xformSys.GetWorldPositionRotation(xform);
+ // Need no rotation on matrix as sun shadow direction doesn't care.
+ var worldMatrix = Matrix3x2.CreateTranslation(worldPos);
var renderMatrix = Matrix3x2.Multiply(worldMatrix, invMatrix);
var pointCount = ent.Comp.Points.Length;
for (var i = 0; i < pointCount; i++)
{
+ // Update point based on entity rotation.
+ indices[i] = worldRot.RotateVec(indices[i]);
+
+ // Add the offset point by the sun shadow direction.
indices[pointCount + i] = indices[i] + direction;
}