Skip to content

physics: Let the ball pass through a trigger's polygon - #593

Open
freezy wants to merge 2 commits into
masterfrom
fix/trigger-polygon
Open

freezy wants to merge 2 commits into
masterfrom
fix/trigger-polygon

Conversation

@freezy

@freezy freezy commented Oct 16, 2026

Copy link
Copy Markdown
Owner

A curved trigger triangulates its top polygon into triangle colliders, plus line and point colliders for its edges and corners. The triangles reported contacts, so the contact solver held the ball up at the trigger's hit height, and the edges and corners were solid as well.

On Terminator 2, the shooter lane switch sits right in front of the auto-plunger. The ball rested on top of the switch, about 20 units above the playfield, and rolled sideways on it. When the launch button was pressed before the ball had settled, it was shot from the edge of that shelf, clipped the lane guides and didn't make it back onto the playfield. The plunger's impulse itself was identical in all cases.

Changes

  • TriangleCollider: the triangles of a trigger follow the non-rigid branch of VP's Hit3DPoly::HitTest. They only report when the ball crosses them (hit or unhit) and never make a contact. A small barycentric tolerance makes sure a crossing on the seam between two triangles of the polygon isn't rejected by both.
  • ColliderUtils.Generate3DPolyColliders takes an onlyTriangles flag, and the trigger generator sets it. VP's Hit3DPoly has no edge or vertex colliders either.
  • New EditMode tests in TriggerPolygonTests.

Not changed: a trigger's side walls (LineCollider, non-rigid) can still report a contact in rare cases, which matches VP's LineSeg::HitTestBasic.

Testing

  • EditMode physics tests (130) pass.
  • In the player, with T2 loaded: the ball now rests on the playfield in front of the plunger, five out of five launches reached the playfield, including one fired while the ball was still rolling sideways, and the shooter lane switch still turns on when the ball arrives and off when it's launched.

A curved trigger's top polygon is triangulated, and its triangles reported
contacts, so the contact solver held the ball up on the trigger's hit height.
Its edges and corners were solid too. A ball in a shooter lane would roll on
the switch like on a shelf and lose most of the plunger's shot when launched
from its edge.

The triangles of a trigger now follow the non-rigid branch of VP's
Hit3DPoly: they only report crossings, never a contact, with a small
tolerance so a crossing on a seam between two triangles isn't missed. Like
VP's Hit3DPoly, the polygon has no edge or vertex colliders.
@greptile-apps

greptile-apps Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previously reported test gap addressed.

Summary

Trigger polygons now let balls pass through while still reporting entry and exit.

  • Trigger tops report crossings without holding the ball up.

The previously reported test gap is addressed by GeneratedPolygonHasNoSolidEdgesAndReportsACrossing. No new actionable issues were found in the changes since the previous review. Tests were not run during this review.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Trigger polygon] --> B[Generate triangles only]
  B --> C[Ball crosses triangle]
  C --> D[Report hit or unhit]
  D --> E[Ball passes through without contact]
Loading

Reviews (2) · Last reviewed commit: "test: Generate a trigger polygon and che..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant