Repository navigation
Conversation
Phase 1: wrap com.github.stephengold:MaVehicles:0.7.2 and jme-ttf:3.0.1 as SDK libraries (routed to jme3-core-libraries by copyBaseLibs/ createBaseXml) and add the com.jme3.gde.core.libraries module dependency to jme3-vehicle-creator. Phase 2: rewrite the editor's data layer around a MaVehicles Vehicle: - EditableVehicle: concrete four-wheeled Vehicle (chassis spatial, two steered front wheels, Engine, GearBox) - SimpleEngine / SimpleWheelModel: default MaVehicles parts - SuspensionSettings migrated to MaVehicles parameters (suspension stiffness/damping/travel, wheel radius/friction/steering, Pacejka tire coefficients, engine power, gear upshift speeds) - VehicleEditorController now builds and edits the EditableVehicle in memory and test-drives it through a minimal VehicleWorld backed by the preview's BulletAppState - TopComponent keeps its UI shell; motor/brake spinners are now 0..1 control signals Co-authored-by: mindbotbot <mindbotbot@users.noreply.github.com>
MaVehicles classes reference jme3-core/Minie/Heart classes (notably jme3utilities.Loadable from Heart). jme3-core-libraries declares no dependency on jme3-core-baselibs, so its module classloader cannot resolve those types, causing ClassNotFoundException: jme3utilities.Loadable when loading com.jayfella.jme.vehicle.Vehicle. Keep the jars in the same module as Minie/Heart (the PR jMonkeyEngine#547 pattern) in both copyBaseLibs and createBaseXml; the vehicle-creator's existing baselibs dependency then covers them, so the core.libraries dependency is dropped again. Co-authored-by: mindbotbot <mindbotbot@users.noreply.github.com>
doCheckVehicle passed the scene root node as the MaVehicles chassis, so setChassis reparented it under the vehicle's private node: the preview went blank (the 'non-visible' geometry) and addToWorld then tried to attach the vehicle node to itself (IllegalArgumentException: Cannot add child to itself). Now the vehicle gets its own chassis node and stays detached from the scene graph while editing; the scene host is captured up front. On 'test vehicle' the edited scene root is moved under the chassis and the vehicle is attached to the host via the captured parent; on stop the vehicle is removed and the scene root is restored. Co-authored-by: mindbotbot <mindbotbot@users.noreply.github.com>
…rive Attach the vehicle node directly under the scene root node when the vehicle is created (parent.attachChild(child)), so it is visible immediately. Physics stays off until 'test vehicle': the BulletAppState is attached on test and detached on stop instead of at scene open. The EditorWorld uses the scene root node as parent directly; re-attaching the already-attached vehicle node is a no-op and setPhysicsSpace is idempotent, so addToWorld is safe. On stop, removeFromWorld detaches the vehicle and it is re-attached to the scene root (visible, no physics). sceneRoot/sceneHost fields are gone. Co-authored-by: mindbotbot <mindbotbot@users.noreply.github.com>
Vehicle.addToWorld attaches five app states. TireSmokeEmitter casts the application to SimpleApplication (ClassCastException under the SDK's SceneApplication) and SkidMarksState needs a DecalManager plus the SkidMark material, neither of which the preview provides. EditorWorld now hands Vehicle a filtering AppStateManager that delegates to the real state manager but never attaches those two cosmetic states. Also set the gears' redline speeds (previously 0, which made AutomaticGearboxState compute NaN engine revs) and name the wheel visual 'wheel' as WheelSpinState requires. Co-authored-by: mindbotbot <mindbotbot@users.noreply.github.com>
Three fixes for the vehicle creator's test drive: 1. Place the suspension connection points at the bottom of the model's bounding box instead of at its center height. The wheels (0.35 radius, 0.2 rest length) could never reach below the chassis collision box, so the vehicle settled on the box and the wheels spun without traction, making it immobile. 2. Start the test drive from the vehicle's current pose in the scene. MaVehicles' warp() derives the drop point from a downward ray test and moves the vehicle far away (about y=-9000) when nothing is below it. The pose captured when testing starts is now applied directly with warpAllBodies(), and restored when testing stops or the reset key is pressed (physics body, vehicle node and wheel nodes). 3. Forward keyboard input to the test drive. The embedded preview canvas is not focusable, so jME's InputManager never sees keyboard events; the scene viewer forwards them only to the active camera controller. The driving keys are now forwarded from Swing in the editor window and from the camera controller (when the scene viewer has focus) into the editor's input handling. Also adds a visible box for the generated chassis and a shared WHEEL_DIAMETER constant. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
Vendor the hatchback example from the jme-vehicles project's MavCommon library (tag library-v0.7.2): the HatchBack vehicle with its engine, sounds, tires and wheels, the modern_hatchback model with PBR textures, and the engine and horn audio. The driver/passenger setup is omitted. The editor's test-drive controls now drive the hatchback: - S engages the reverse gear instead of sending a negative accelerate signal, which MaVehicles rejects; W re-engages a forward gear. - The accelerate signal is refreshed every frame while testing and withdrawn at the gearbox's speed limits, as in MaVehicles' own demo, capping reverse at the reverse gear's top speed. - Steering keys assign the steering value directly, so a missed key release can no longer leave the wheels steered. - Stopping a test drive also re-engages a forward gear. Also pin jme3-testdata to a version that provides the Racetrack model used by the preview. Generated by Mistral Vibe. Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
|
Some tweaks left. Steering. Scene loading |
| * while the vehicles' forward is +Z, so a camera node must be flipped | ||
| * to look forward | ||
| */ | ||
| private static final Quaternion flipYaw |
There was a problem hiding this comment.
This quaternion is described and used as a 180° yaw to make the dash camera look along the vehicle’s +Z forward axis, but an angle of 0 creates the identity rotation. As written, first-person mode leaves the camera facing the vehicle’s -Z direction. Could you rotate by π here?
| private static final Quaternion flipYaw | |
| = new Quaternion().fromAngleAxis(FastMath.PI, Vector3f.UNIT_Y); |
| public void setCreateNode(boolean createNode) { | ||
| this.createNode = createNode; | ||
| public void loadFromWheel(Wheel wheel) { | ||
| Suspension suspension = wheel.getSuspension(); |
There was a problem hiding this comment.
loadFromWheel copies the other suspension settings but leaves maxTravelCm unchanged. This means loading a wheel and then applying these settings can silently replace that wheel’s travel with the default (or a stale value), rather than preserving the loaded configuration. Please load the travel value here as well, and consider round-tripping the tire coefficients for the same reason.
jaime-jmebot
left a comment
There was a problem hiding this comment.
Hi, thanks for putting together this substantial migration. Moving the editor onto MaVehicles while keeping its existing UI shell is a useful direction, and the dependency routing through baselibs is clearly motivated by the module classloader constraints. I reviewed the editor/controller changes, tuning settings, camera handling, dependency setup, and the vendored example vehicle; the CI build is still in progress, so I have not treated it as verified yet.
I found one camera behavior issue in the new first-person mode: the purported 180° yaw currently uses a zero-angle quaternion, so the camera remains pointed opposite the vehicle’s +Z forward direction. I also noted that loadFromWheel does not read back maximum suspension travel, meaning a load-and-reapply round trip can overwrite a wheel’s existing value with the settings default. I left inline comments on both points.
The separation of tuning values into SuspensionSettings and the shared application methods make the new editor model straightforward to follow. Once those round-trip and orientation details are addressed, this will be in good shape; please also check the pending CI result before merging. Thanks for the careful work on this migration.
Summary
Implements phases 1 and 2 of the jme-vehicles (MaVehicles) migration plan for jme3-vehicle-creator.
Phase 1 — dependency plumbing
Phase 2 — editable four-wheeled vehicle
Out of scope per the plan: loading old PhysicsVehicle scenes, a new vehicle file format, bikes/props, test-drive HUD/chase cam polish, and .j3o export (note: in 0.7.2 Vehicle implements Heart's Loadable, not Savable — the Savable/.j3o story applies to the unpublished 0.7.3-SNAPSHOT, a phase-4 decision).
Verification