Skip to content

Various updates#554

Merged
freezy merged 14 commits intomasterfrom
dev
Apr 18, 2026
Merged

Various updates#554
freezy merged 14 commits intomasterfrom
dev

Conversation

@freezy
Copy link
Copy Markdown
Owner

@freezy freezy commented Apr 18, 2026

Gameplay / Simulation fidelity

  • Added plunger “fire and pull back” mode for kickback behavior.
  • Updated flipper tricks implementation to align with more modern nfozzy/rothbauerw behavior.

Import pipeline and authoring workflow

  • Added new import modes for collidable-focused workflows:
    • dump table script,
    • render bumpers as colliders,
    • skip image/sound import,
    • force a single material pass.
  • Fixed playfield mesh UV generation issues.

Performance / runtime correctness

  • Lamp manager now batches activation updates.
  • Faux bulbs are hidden when lights are off.
  • Added physics debug render mask to show only physics-relevant components.

Platform / input / dependency updates

  • Added missing input key mappings.
  • Bumped native input dependency to v0.0.4.
  • Added Linux native input plugin metadata.
  • Included material version refresh updates.

Docs / developer support

  • Creator/developer documentation touched to reflect new/updated behaviors and tooling.

Practical Impact

  • Better table behavior parity and tuning control (flippers/plunger).
  • Faster, more targeted import iteration when focusing on collision/physics.
  • Cleaner debugging surface for physics work.
  • Reduced runtime noise for light/bulb visuals and lamp updates.
  • Improved cross-platform readiness (notably Linux native input handling).

@freezy freezy requested a review from Copilot April 18, 2026 22:54
@freezy freezy self-assigned this Apr 18, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates Visual Pinball Engine’s Unity integration to improve gameplay fidelity (plunger + flipper tricks/live-catch), expand the VPX import workflow with collider-focused modes, and refine runtime/editor tooling (native input mappings, lamp toggling, physics debug visualization, and UV/material handling).

Changes:

  • Added new plunger coil mode (“fire and pull back”) and updated flipper tricks/live-catch parameters/logic to better match modern VPW behavior.
  • Expanded VPX import options (collidable-only import, skipping textures/sounds, dumping table script, override materials) and fixed playfield UV projection.
  • Updated native input actions/default bindings, switch dispatch behavior, and added editor-only physics render masking/debugging utilities.

Reviewed changes

Copilot reviewed 39 out of 40 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampWireMeshComponent.cs Uses ramp mesh-generation data that can be derived from collider geometry during import.
VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampWallMeshComponent.cs Same as above for ramp wall meshes.
VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampFloorMeshComponent.cs Same as above for ramp floor meshes.
VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs Adds collider-driven ramp mesh data path and collision-wall height mapping for collider-only import workflows.
VisualPinball.Unity/VisualPinball.Unity/VPT/Plunger/PlungerComponent.cs Exposes new coil item id for “fire and pull back”.
VisualPinball.Unity/VisualPinball.Unity/VPT/Plunger/PlungerApi.cs Implements new coil behavior and supports firing from full retract vs current position.
VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs Applies playfield UV projection based on table bounds during referenced-data setup.
VisualPinball.Unity/VisualPinball.Unity/VPT/MainRenderableComponent.cs Allows import-time skipping of surface parenting via ImportContext.
VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs Tracks emissive renderers as faux bulbs; ensures dark-at-start and hides/dims with intensity.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperTricksData.cs Adds base dampen parameters for updated live-catch model.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperComponent.cs Plumbs new live-catch parameters from collider component into runtime data.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperColliderComponent.cs Updates tooltip text and defaults to align with modern VPW-style tuning.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperCollider.cs Reworks live-catch logic and integrates it into collision flow.
VisualPinball.Unity/VisualPinball.Unity/VPT/Bumper/BumperComponent.cs Adds editor-only collider-visual import mode for bumper collider-focused workflows.
VisualPinball.Unity/VisualPinball.Unity/Simulation/SimulationThread.cs Adds switch inversion/toggle behaviors and expands flipper action classification and hint mapping.
VisualPinball.Unity/VisualPinball.Unity/Simulation/NativeInputManager.cs Adds polling-state exposure and expands default native bindings.
VisualPinball.Unity/VisualPinball.Unity/Simulation/NativeInputApi.cs Expands native input action/keycode enums to cover more cabinet controls.
VisualPinball.Unity/VisualPinball.Unity/Input/InputManager.cs Adjusts default InputSystem bindings for coins/service actions.
VisualPinball.Unity/VisualPinball.Unity/Import/ImportContext.cs.meta New Unity meta for ImportContext.
VisualPinball.Unity/VisualPinball.Unity/Import/ImportContext.cs Introduces global import-time flags consumed by runtime components during editor conversion.
VisualPinball.Unity/VisualPinball.Unity/Game/SwitchPlayer.cs Avoids double-dispatch by skipping InputSystem switch path when native polling is active.
VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsRenderMaskComponent.cs.meta New Unity meta for physics render mask component.
VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsRenderMaskComponent.cs Adds editor-only physics-collider render masking for debugging physics-relevant geometry.
VisualPinball.Unity/VisualPinball.Unity/Game/CoilPlayer.cs Initializes “fire and pull back” plunger mode to a pulled-back idle state on startup.
VisualPinball.Unity/VisualPinball.Unity.Editor/VPT/Flipper/FlipperColliderInspector.cs Exposes new live-catch fields and updates labels for clarity.
VisualPinball.Unity/VisualPinball.Unity.Editor/Utils/AssetReferenceLocator.cs Sorts results for determinism/readability in editor tooling output.
VisualPinball.Unity/VisualPinball.Unity.Editor/Managers/Lamp/LampManager.cs Improves lamp toggling to use APIs in play mode and handle groups/edit-mode correctly.
VisualPinball.Unity/VisualPinball.Unity.Editor/Import/VpxSceneConverter.cs Adds new import options (filters, dumping script, override materials) and sets ImportContext flags during conversion.
VisualPinball.Unity/VisualPinball.Unity.Editor/Import/VpxImportWizardSettings.cs Stores new import wizard settings in EditorPrefs and builds ConvertOptions.
VisualPinball.Unity/VisualPinball.Unity.Editor/Import/VpxImportWizard.cs Extends wizard UI to configure new import modes/options and passes ConvertOptions through import.
VisualPinball.Unity/VisualPinball.Unity.Editor/Import/MenuImporter.cs Adds a menu item to open the import wizard preconfigured for collidable-only workflow.
VisualPinball.Unity/Plugins/linux-x64/libVpeNativeInput.so.meta Updates Linux native input plugin importer metadata (platform gating needs correction).
VisualPinball.Unity/Documentation~/developer-guide/setup.md Documents NativeInput’s NuGet + plugin-copy workflow and updates meta ignore guidance.
VisualPinball.Unity/Documentation~/creators-guide/toc.yml Adds “Plungers” page to creators guide TOC.
VisualPinball.Unity/Documentation~/creators-guide/manual/mechanisms/plungers.md New creator documentation for plunger setup and coil modes (incl. kickback pattern).
VisualPinball.Unity/Assets/Resources/Materials/Segment Display (SRP).mat Material version refresh update.
VisualPinball.Unity/Assets/Resources/Materials/Dot Matrix Display (SRP).mat Material version refresh update.
VisualPinball.Engine/VisualPinball.Engine.csproj Bumps VisualPinball.NativeInput to v0.0.4 and clarifies NuGet deployment intent.
VisualPinball.Engine/VPT/Table/TableMeshGenerator.cs Adjusts playfield triangulation to match VPX’s implicit mesh.
.gitignore Ignores AGENTS.md.
Comments suppressed due to low confidence (1)

VisualPinball.Unity/Plugins/linux-x64/libVpeNativeInput.so.meta:47

  • The plugin import settings for libVpeNativeInput.so appear to enable the Linux .so for Windows (Win/Win64) and for Any with Exclude Win/Win64 = 0. This will cause Unity to try to load/include the Linux binary on Windows builds/editors. Update the .meta so only Linux64 (and Linux Editor) are enabled, with Any disabled (or excluding Win/Win64), matching the platform gating used by other plugins in Plugins/<rid>.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread VisualPinball.Unity/VisualPinball.Unity/Simulation/NativeInputManager.cs Outdated
Comment thread VisualPinball.Unity/VisualPinball.Unity/Input/InputManager.cs Outdated
Comment thread VisualPinball.Unity/VisualPinball.Unity/Simulation/NativeInputApi.cs Outdated
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 18, 2026

Greptile Summary

This is a broad multi-area PR touching simulation fidelity, import tooling, platform input, and runtime rendering. The changes are well-structured and the core logic is sound across all areas.

Key changes:

  • Plunger: New FireAndPullBackCoil coil type cleanly wires FireFromFullRetract / PullBack for kickback behavior.
  • Flipper live-catch: Rewritten to align with modern nfozzy/rothbauerw semantics — FlipperTricksData parameter correctly changed from ref to in, and LiveCatch() is now called after the collision impulse rather than before it. Two new fields (LiveCatchBaseDampenDistance, LiveCatchBaseDampen) are packed/unpacked with nullable fallback for forward-compatibility.
  • Import pipeline: VpxSceneConverter gains collidable-only filtering, material override, table script dump, and forced-visible mode. ImportContext global static state is correctly saved/restored in a try/finally block in the converter.
  • Physics debug mask: New PhysicsRenderMaskComponent (editor-only, 689 lines) renders live collider geometry on top of game objects. Has a subtle race in Start() where Apply() is called unconditionally after the PhysicsEngine init wait, even if IsEnabled changed to false during that window.
  • Lamp manager: Turn On/Turn Off buttons now route through ILampDeviceComponent.GetApi().OnLamp() in play mode to update both lights and emissive materials; falls back to direct Light.enabled toggle in edit mode.
  • Faux bulbs: Emissive MeshRenderers are hidden and faded to black when lamp intensity is zero, preventing baked emissive defaults from appearing lit at start.
  • Input: GetCanonicalActionName() normalizes legacy/alias action names, eliminating double-dispatch when native input polling is active. Default bindings for staged flippers, magnasaves, service keys, and nudging are added. ActionFire1's conflicting leftCtrl binding is removed.
  • Playfield UV fix: ApplyPlayfieldUvProjection() now maps vertex positions to UV using table bounds before TransformToWorld(), and the mesh triangulation is updated to match VPX's winding.

Confidence Score: 4/5

Safe to merge; the one logic issue is isolated to a debug-only editor component and requires a very specific timing window to trigger.

The core simulation changes (live-catch rewrite, plunger coil, input dispatch) are well-implemented. The import pipeline correctly saves and restores global state. The prior thread concern about live-catch defaults was explicitly resolved by the author. The only newly-found functional issue (PhysicsRenderMaskComponent.Start coroutine not checking IsEnabled before Apply()) is confined to a debug editor-only tool and requires toggling the component during the up-to-300-frame physics engine init window — an unlikely scenario in practice.

VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsRenderMaskComponent.cs — Start() coroutine Apply() guard

Important Files Changed

Filename Overview
VisualPinball.Unity/VisualPinball.Unity/Game/PhysicsRenderMaskComponent.cs New 689-line editor-only debug component that renders physics collider geometry in-place; has a subtle race condition where Apply() is called after the 300-frame init wait regardless of the current IsEnabled value, and incorrect normals on the initial CircleCollider cylinder panel.
VisualPinball.Unity/VisualPinball.Unity/VPT/Plunger/PlungerApi.cs Adds FireAndPullBackCoil for kickback-style behavior; cleanly refactors Fire() to accept an optional startPositionOverride, routing through the existing PlungerCommands.Fire() path.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperCollider.cs Rewrites live-catch physics to align with modern nfozzy/rothbauerw behavior; changes parameter from ref to in for FlipperTricksData and moves LiveCatch call to after the impulse application; logic looks correct.
VisualPinball.Unity/VisualPinball.Unity.Editor/Import/VpxSceneConverter.cs Major import pipeline expansion adding collidable-only filtering, material override, table script dump, and playfield UV projection; uses try/finally to restore global ImportContext state correctly.
VisualPinball.Unity/VisualPinball.Unity/Import/ImportContext.cs New global static context carrier for editor-driven import flags; state is saved/restored with try/finally in the converter, making the pattern safe for sequential imports.
VisualPinball.Unity/VisualPinball.Unity/VPT/Bumper/BumperComponent.cs Adds collider-cylinder visual mode for the collidable-only import workflow; editor-only fields ColliderVisualName and _colliderCylinderMesh are declared outside the #if UNITY_EDITOR guard, including them in player builds unnecessarily.
VisualPinball.Unity/VisualPinball.Unity.Editor/Managers/Lamp/LampManager.cs Refactors Turn On/Off buttons to route through the lamp API in play mode and fall back to direct Light toggling in edit mode; logic looks correct with proper null checks.
VisualPinball.Unity/VisualPinball.Unity/VPT/Light/LightComponent.cs Adds faux-bulb renderer tracking and SetFauxBulbVisibility() to hide emissive meshes when lights are off; SetFauxBulbVisibility is called redundantly once from SetMaterialIntensity and once directly in OnAwake, but this is harmless.
VisualPinball.Unity/VisualPinball.Unity/Simulation/SimulationThread.cs Adds _actionInvertsPressed, _actionToggleOnPress, and _actionSwitchStates arrays to properly handle normally-closed switches and coin-door toggle-on-press semantics; sync path updated from raw pressed state to computed isClosed value.
VisualPinball.Unity/VisualPinball.Unity/Simulation/NativeInputManager.cs Expands default bindings to cover staged flippers, magnasaves, coin chutes, service keys, and nudging; Service5 has no default binding (reserved enum slot only), which appears intentional.
VisualPinball.Unity/VisualPinball.Unity/VPT/Ramp/RampComponent.cs Adds GetMeshGenerationData() to return collision geometry parameters as visible wall heights for wire-ramp types; CollisionGeometryRampData wrapper correctly delegates all other properties to the source.
VisualPinball.Unity/VisualPinball.Unity/VPT/Playfield/PlayfieldComponent.cs Fixes playfield mesh UV generation by applying table-bounds-based UV projection before TransformToWorld(); the new ApplyPlayfieldUvProjection correctly computes planar UV from table Left/Right/Top/Bottom.
VisualPinball.Unity/VisualPinball.Unity/VPT/Flipper/FlipperPackable.cs Extends FlipperColliderPackable with nullable fields for all new flipper tricks parameters; Unpack uses null-coalescing to preserve existing component values when fields are absent in older packages.
VisualPinball.Unity/VisualPinball.Unity/Input/InputManager.cs Adds GetCanonicalActionName() to normalize legacy/alias action names to canonical ones; default asset now registers alias actions without bindings, avoiding double-binding conflicts.
VisualPinball.Engine/VPT/Table/TableMeshGenerator.cs Fixes playfield mesh triangle winding from {0,1,3,0,3,2} to {0,1,2,2,1,3} to match VPX's implicit playfield triangulation, correcting UV interpolation across the diagonal.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    subgraph Import["Import Pipeline (VpxSceneConverter)"]
        IO["ImportOptions"] --> F1{"ObjectImportFilter\n= CollidableOnly?"}
        F1 -- Yes --> IC["ImportContext.UseCollider\nGeometryFor*Meshes = true"]
        IC --> FC["Filter renderables\nto physics-loop objects only"]
        FC --> BC["BumperComponent:\nApplyColliderOnlyVisual()"]
        FC --> RC["RampComponent:\nGetMeshGenerationData()\n→ CollisionGeometryRampData"]
        F1 -- No --> ALL["Import all renderables\n(normal path)"]
        IO --> F2{"DumpTableScript?"}
        F2 -- Yes --> DS["Write .vbs file to Assets"]
        IO --> F3{"OverrideVisualMaterial?"}
        F3 -- Yes --> OM["All objects share\none override material"]
        F3 -- No --> NM["Normal PBR material pipeline"]
    end

    subgraph Simulation["Simulation / Input"]
        NIM["NativeInputManager\n(polling thread)"] --> ST["SimulationThread"]
        ST --> ATS["_actionSwitchStates[]\n(NC + toggle-on-press aware)"]
        ATS --> ID["InputDispatcher\n.DispatchSwitch()"]
        UIS["Unity InputSystem\n(fallback when not polling)"] --> SP["SwitchPlayer\nHandleKeyInput()"]
        SP --> ID
        CN["GetCanonicalActionName()"] -. normalizes .-> SP
        CN -. normalizes .-> ST
    end

    subgraph Physics["Physics / Simulation Fidelity"]
        FC2["FlipperCollider.Collide()"] --> LC["LiveCatch()\nnow called AFTER impulse\nwith in FlipperTricksData"]
        PA["PlungerApi"] --> FAPC["FireAndPullBackCoil\n→ FireFromFullRetract / PullBack"]
    end

    subgraph Debug["Debug (Editor-only)"]
        PRMC["PhysicsRenderMaskComponent"] --> APL["Apply()\nDisables original renderers\nGenerates collider mesh geometry"]
        APL --> CM["BuildColliderMesh()\nLine / Circle / Triangle / Flipper"]
    end
Loading

Reviews (2): Last reviewed commit: "packaging: Add missing attributes." | Re-trigger Greptile

@freezy freezy merged commit d868135 into master Apr 18, 2026
16 checks passed
@freezy freezy deleted the dev branch April 18, 2026 23:22
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.

2 participants