Skip to content

Commit

Permalink
trigger: Use non-transformable colliders.
Browse files Browse the repository at this point in the history
  • Loading branch information
freezy committed Nov 29, 2024
1 parent 0079299 commit eb1b345
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ internal int Add(LineSlingshotCollider collider, float4x4 matrix)
}

internal int Add(LineCollider collider) => Add(collider, float4x4.identity); // used for the playfield only
private int Add(LineCollider collider, float4x4 matrix)
internal int Add(LineCollider collider, float4x4 matrix)
{
if (LineCollider.IsTransformable(matrix)) {
collider.Header.IsTransformed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public TriggerColliderGenerator(TriggerApi triggerApi, TriggerComponent componen
_meshComponent = meshComponent;
_colliderComponent = colliderComponent;
_matrix = matrix;

}

internal void GenerateColliders(ref ColliderReference colliders)
Expand Down Expand Up @@ -75,13 +76,13 @@ private void GenerateCurvedHitObjects(ref ColliderReference colliders)
for (var i = 0; i < count; i++) {
var pv2 = rgv[i < count - 1 ? i + 1 : 0];
var pv3 = rgv[i < count - 2 ? i + 2 : i + 2 - count];
AddLineSeg(pv2.ToUnityFloat2(), pv3.ToUnityFloat2(), height, ref colliders);
colliders.Add(new LineCollider(
pv2.ToUnityFloat2(),
pv3.ToUnityFloat2(),
height,
height + math.max(_colliderComponent.HitHeight - 8.0f, 0f),
_api.GetColliderInfo()), _matrix);
}
}

private void AddLineSeg(float2 pv1, float2 pv2, float height, ref ColliderReference colliders) {
colliders.AddLine(pv1, pv2, height, height + math.max(_colliderComponent.HitHeight - 8.0f, 0f),
_api.GetColliderInfo(), _matrix);
}
}
}

0 comments on commit eb1b345

Please sign in to comment.