Fix VehicleCreator not receiving keyboard input#685
Conversation
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 <7988802+neph1@users.noreply.github.com>
Co-authored-by: neph1 <7988802+neph1@users.noreply.github.com>
|
@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? |
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, 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:
The steering works because |
Keyboard events for vehicle controls (WASD, Space, Enter) never reached
VehicleEditorController.onAction()becauseSceneViewerTopComponentforwards AWT key events only to the active camera controller'sonKeyEvent(), bypassing the jME3InputManagerentirely.Changes
onKeyEvent()to forward key events toVehicleEditorController, following the pattern used byComposerCameraControlleronKeyEvent()that translates key codes to action bindings and delegates toonAction()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/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/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/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
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.