Why does my FancyCar go backward?

hi.
i import my car model to test fancy car game it moves but to backward.
i change the code

Vector3f wheelDirection = new Vector3f(0, -1, 0);
Vector3f wheelAxle = new Vector3f(-1, 0, 0);

to:

Vector3f wheelDirection = new Vector3f(0, -1, 0);
Vector3f wheelAxle = new Vector3f(1, 0, 0);

now it goes forward but the wheels Rotates backward (Conversely).
thank you very much

I feel like there is a “In soviet russia” joke in there somewhere.

So I’d say the solution is really simple. Leave the wheels as they are, but do this:
When you’re calling control.accelerate(value); you should invert the value. Where control is the VehicleControl.

Another thing you can try is comparing your code with the tutorial example.

1 Like

Hi!

I think the first solution should be the right one. Maybe you accelarate in the wrong direction? The TestFancyCar is going backwards, so you should change the “direction” to the “opposite”.

Float accelerationValue = 100f;
control.accelerate(accelerationValue);

Note: The acceleration value is positive, so the car will go forward. The car In the FancyCarDemo is accelerating forward with negative values.

EDIT: Pfffft, MoffKalast was faster… :smile:

1 Like

Aha!
http://i.imgur.com/QCQ2zOW.jpg

1 Like

thank you it goes forward but why the wheels return to inside(caps of wheels return to inside).
it means now back of wheels are outside?

Hi, I’m new to the forum and jme(I love it :smile: ).
Asdb20, how I got the car to work:

Make sure in blender the car faces the same way as the green arrow.
In code use:

Vector3f wheelDirection = new Vector3f(0, -1, 0);
Vector3f wheelAxle = new Vector3f(1, 0, 0);

This should be enough to get the wheels right (it did for me)
Hopefully this will work for you too :grinning:

EDIT: Sorry, I forgot to mention this is a solution to wheels not facing outwards.

hi.
i know but in this case my car model wheels rotates backward.
thanks

Try changing wheelDirection, instead of wheelAxle.

Hey, thanks to you I also noticed my wheels turn in the wrong direction. I think I found a workaround for that:
First change your code back to where you had your wheels facing inwards but rotating in the right direction.

Before

wheel_fl.center();

Insert

wheel_fl.setLocalRotation(new Quaternion().fromAngleAxis((float)Math.toRadians(180), new Vector3f(0, 1, 0)));

This rotates the wheel before it’s added to the car control. Do this for all 4 wheels. They should still be turning the right way.

2 Likes

oh yes it works well thank you very much.