Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 26, 2025

Keyboard events for vehicle controls (WASD, Space, Enter) never reached VehicleEditorController.onAction() because SceneViewerTopComponent forwards AWT key events only to the active camera controller's onKeyEvent(), bypassing the jME3 InputManager entirely.

Changes

  • VehicleCreatorCameraController: Override onKeyEvent() to forward key events to VehicleEditorController, following the pattern used by ComposerCameraController
  • VehicleEditorController: Add onKeyEvent() that translates key codes to action bindings and delegates to onAction()
  • VehicleCreatorTopComponent: Wire up the editor controller reference to the camera controller
// VehicleCreatorCameraController.java
@Override
public void onKeyEvent(KeyInputEvent kie) {
    super.onKeyEvent(kie);
    if (editorController != null) {
        editorController.onKeyEvent(kie);
    }
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • archive.apache.org
    • Triggering command: /usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/gradle-launcher-8.6.jar -javaagent:/home/REDACTED/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/agents/gradle-instrumentation-agent-8.6.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon (dns block)
  • java.sun.com
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/working/files-to-index8852255008887610968.list --sourceArchiveDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/trap/java (dns block)
  • www.netbeans.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.23.3/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/working/files-to-index8852255008887610968.list --sourceArchiveDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/sdk/.codeql-scratch/dbs/java/trap/java (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>VehicleCreator not receiving input</issue_title>
<issue_description>For some reasons the inputs don't reach the onAction method.
I've tried adding it as a RawInputListener.
Events are emitted, as I've seen them in debug in the camera class (which is also a RawInputListener)
There I can see that the VehicleEditorController is indeed in the list.

Why would events come to the camera, but not the VehicleEditorController?

The only reason I can see is if the event is consumed, somehow. But why? And who?</issue_description>

<agent_instructions>This is going to be really difficult to debug without running the actual build, but give it a try. Analyze why events don't reach VehicleEditorController, but obviously are emitted since the camera gets them. The sub project is: https://github.com/jMonkeyEngine/sdk/tree/master/jme3-vehicle-creator
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 26, 2025 21:14
The root cause was that keyboard events captured by SceneViewerTopComponent
were only forwarded to the active camera controller's onKeyEvent method,
but never reached the jME3 InputManager. This meant VehicleEditorController's
input mappings registered via InputManager.addListener were never triggered.

The fix follows the pattern used by ComposerCameraController:
1. VehicleCreatorCameraController now overrides onKeyEvent to forward
   key events to VehicleEditorController
2. VehicleEditorController now has an onKeyEvent method that translates
   key codes to action bindings and calls onAction
3. VehicleCreatorTopComponent passes the editorController reference to
   the cameraController

Co-authored-by: neph1 <[email protected]>
Copilot AI changed the title [WIP] Fix VehicleCreator not receiving input events Fix VehicleCreator not receiving keyboard input Nov 26, 2025
Copilot AI requested a review from neph1 November 26, 2025 21:20
@neph1
Copy link
Contributor

neph1 commented Dec 11, 2025

@copilot your work has fixed the input, great! the wheels of the vehicle are now turning when pressing A or D. I also notice (with some printouts) that W triggers acceleration. The vehicle however doesn't move (but accelerationValue increases). There seems to be some problem with the underlying libraries. Is it possible for you to debug VehicleControl and below?

Copy link
Contributor Author

Copilot AI commented Dec 11, 2025

@copilot your work has fixed the input, great! the wheels of the vehicle are now turning when pressing A or D. I also notice (with some printouts) that W triggers acceleration. The vehicle however doe...

VehicleControl is part of the jME3 Bullet physics library (not this SDK repository), so I can't directly debug it. However, the likely issue is with how acceleration is applied to the wheels.

In jME3, VehicleControl.accelerate() typically needs a wheel index parameter to apply force to specific wheels. The current code calls vehicleControl.accelerate(accelerationValue) which may be applying force incorrectly or to the wrong wheels.

For a typical rear-wheel-drive vehicle, you'd need something like:

// Apply to rear wheels (indices 2 and 3 typically)
vehicleControl.accelerate(2, accelerationValue);
vehicleControl.accelerate(3, accelerationValue);

Could you verify:

  1. How many wheels are added to the vehicle?
  2. Which wheels are marked as "front" vs "rear" (isFrontWheel flag)?
  3. What the actual VehicleControl.accelerate() method signature expects?

The steering works because steer() typically applies to all wheels or front wheels automatically, but acceleration usually needs explicit wheel indices.

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.

VehicleCreator not receiving input

2 participants