Vehicle Creator Plugin improvements

Hi guys,



As said here http://hub.jmonkeyengine.org/groups/jmonkeyplatform/forum/topic/sdk-plugins-looking-for-developers/?topic_page=3&num=15#post-154829, I started to play with the Vehicle Creator Plugin. By following the wiki instructions, there was no problem to build and run the SDK from source.



As suggested, I´ve used the Ferrari model and created a vehicleControl with the plugin using the default settings. First thing I noticed is that, when you keep pressing the “W” key, the car goes too fast and you can´t stop it anymore, even if you try to reset by pressing “Enter”. Does it happen with you?



So, to really reset it to initial state, I had to add the line “vehicleControl.accelerate(0);” inside the reset command. This is a little strange because the jme3test.bullet.TestFancyCar.java uses the same code and the vehicle resets properly…



I´ll continue to play with the plugin to get a better insight on what improvements are needed. Any suggestion is appreciated! :slight_smile:



Cheers,



Diogo

3 Likes

Hey, cool to see you are starting to get your hands dirty. The “test drive” feature is really not very robust and pretty much quick’n’dirty code… Can very well be theres issues with that. I guess having a better usability and visual feedback is the most important thing, I don’t know how many people use the plugin and I obviously know how to use it and what to expect but I guess it could be made more obvious… Also maybe support for generic wheels or loading wheels from other models would be cool too.

Cheers,

Normen

Very nice @dvsantos. I wish good luck for you with that! This plugin promisses be very useful for us ;).

Tks for the feedback, guys.



Yeah, the usage is not so obvious. Maybe defining a fixed workflow in the interface would help.

Also, I was thinking of adding a chase cam for the test drive feature, and enabling to select and add a wheel by clicking on it.



Before doing any major change, I’m trying to fix this issue I mentioned above. I’ve put some logs, and it seems like the “onAction” method is receiving more calls than expected, but not only when I press or release the “W” key. This behavior is supposed to happen only if you use the Analog listener, right? Curiously, It doesn’t happen in my Ubuntu machine, but only in the WinXP.

Did you install the latest stable updates?

About the analog listener issue, it’s very strange. I use ubuntu, and it works very fine for me. About the plugin itself, you can take a look at vehicle editors from other engines so you can archive nice ideas. e.g.: unity 3d: http://www.youtube.com/watch?v=PsMonc7oZao.

Yes, I´m using the latest stable.



The jme3test.bullet.TestFancyCar.java handles the input by implementing the ActionListener interface, the same way the VehicleEditorController does. But, in the TestFancyCar case, the onAction method is called only two times: when I press and release “W”. In the plugin, If I keep the “W” key pressed, the method is called more than once, during the time the key is pressed. It receives more than two events.



Curiously, It happens both in Linux and WinXP. But in WinXP, most of the times, the value of the action is “true” (indicating the key was pressed) and the car accelerates too fast, losing control :frowning:

Humm, nice video @glaucomardano



I liked this idea of keeping some default models and wheels inside the Editor.

Btw looking again the video, that vehicle editor has the Fancy Car as one of its default cars :).

Well, it seems like com.jme3.input.awt.AwtKeyInput class always create an input event with repeat = false



[java]

public void keyPressed(KeyEvent evt) {

int code = convertAwtKey(evt.getKeyCode());

KeyInputEvent keyEvent = new KeyInputEvent(code, evt.getKeyChar(), true, false);

keyEvent.setTime(evt.getWhen());

synchronized (eventQueue){

eventQueue.add(keyEvent);

}

}

[/java]



So, as a consequence, the inputManager onKeyEventQueued method always call the invokeActions method.



[java]

private void onKeyEventQueued(KeyInputEvent evt) {

if (evt.isRepeating()) {

return; // repeat events not used for bindings

}



int hash = KeyTrigger.keyHash(evt.getKeyCode());

invokeActions(hash, evt.isPressed());

invokeTimedActions(hash, evt.getTime(), evt.isPressed());

}

[/java]



It doesn´t occur with the TestFancyCar because the keyboard events are handled by com.jme3.input.lwjgl.LwjglKeyInput, which employs another logic.

can you fix it?