JME beginner: how do i make a vehicle turn left/right move forward properly?

Hi, this might probably be a really simple solution but i’ve been stuck at it for a really long time. please help! :frowning:



i’ve come across some jme2 tutorials, the one on flagrush.

( https://wiki.jmonkeyengine.org/legacy/doku.php/jme2:flag_rush_tutorial_series_by_mojomonkey )

how they made the vehicle turn was codes like:



KeyNodeForwardAction forward = new KeyNodeForwardAction(node, 30f);

addAction(forward, “forward”, true);



KeyNodeBackwardAction backward = new KeyNodeBackwardAction(node, 15f);

addAction(backward, “backward”, true);



KeyNodeRotateRightAction rotateRight = new KeyNodeRotateRightAction(node, 5f);

rotateRight.setLockAxis(node.getLocalRotation().getRotationColumn(1));

addAction(rotateRight, “turnRight”, true);



KeyNodeRotateLeftAction rotateLeft = new KeyNodeRotateLeftAction(node, 5f);

rotateLeft.setLockAxis(node.getLocalRotation().getRotationColumn(1));

addAction(rotateLeft, “turnLeft”, true);



however i can’t use these codes in jme3 can i? searched high and low for a KeyNodeRotateLeftAction etc but found nothing.



so i saw some stuff on bullet, VehicleControl, etc. where the vehicle can steer left and right just by calling the function steer().



so my question is, is there any other simpler method that i can use? i do not require the complicated physics related to a vehicle. just be able to move forward, turn left and turn right (at a constant speed).

Look up TestFancyCar. It explains it there. (It’s in the test examples, btw).





-NomNom

yup, I’ve tried using that example before. however, i’m having problems with compiling the program as they say “cannot find symbol” for the VehicleControl class. I’m using jme3 alpha 3. do i require alpha 4 instead? i will not encounter this problem using alpha 4, but the program automatically exits whenever i try to run it. so i switched back to alpha 3. kindly advise… thanks

You should always work with the updated version (even if that means changing all of your code).



Well, what I would do is just use TestFancyCar as the base and then modifying it from there. I’m not quite sure whether or not that’s the best practice, but it helps me understand it and be able to use the needed classes later without relying on anything. I guess we’ll just have to wait for Normen :wink:

Alpha - 3 was released Novemember last year. I also downloaded Alpha-3 and didnt have all the physics controls until updating it to the latest svn revision. As nomnom says, you will have to update your jme3 eventually to the latest stable build, if you want to use jme3.

Maybe there are some solutions to your updating problem in the JMPlatform section of the forum. If nothing works, you can always just download the sources and use another IDE, like eclipse or netbeans. That should always work!

alright, will work on it! thanks so much :slight_smile:

I am transferring my question to this thread as my original post got locked.



I am having troubles getting a car suspension working. I have created a car model and tried to get it to work by modifying testfancycar.java to use my model. I have also tried to import my model to jmonkeyplatform. With jmonkeyplatform I got a car which just flips over when I press “test vehicle” button. Also the wheels seem to misplace and even turn 180 so that I can’t even see them, because backside of faces are pointing to the camera.



With testfancycar.java (with my own model) I get also these problems. Best result I have got is that I have somekind of suspension working but the vehicle flips over very easily.



Model and source code can be found from: http://users.utu.fi/sampie/car/.



What modifications I need to do in order to get properly working suspension and wheels that can be actually seen? I am using quite recent JME 3 nightbuild version and jmonkeyplatform alpha-4 (with plugins updating every day).



Thanks.

Uh, sorry sampie, I somehow looked at your one post twice… In fact its two separate problems here… I will unlock the other thread.