Racing: rubbing walls?

Hi, I'm new to JME. I'm relatively new to programming but I have been able to play around with JME.



Basically I'm trying to make a racing game where the track will be surrounded by walls. Whenever you hit a wall, I want the car to follow the contour of the wall (and to lose speed, which is easy). The problem is that I don't know how or if i can do this using JME or if I have to implement it by myself.



If I wanted to make the car bounce, I could use the normals of the triangles in question but how to make the car follow the walls, particularly on the corners? Any tips? To point me in the right direction?

Hi, :slight_smile:



have you tried com.jmetest.physics.vehicle.TestAdvancedVehicle, the jMEPhysics2-Demo?

The game uses ODE for the physics.

It is fun to drift and drive with that car.

Perhaps you can use it as a starting point for your game. :slight_smile:



Good luck :slight_smile:

JackNeil

Hi. Thanks for the quick answer  :smiley:

Wow that looks exactly as what I'm looking for! The AdvancedVehicle runs pretty smooth.



I just have one problem, all the examples work great except for the TestAdvancedVehiclePlus.java one. It just shows me the vehicle parked near some sort of loop but the game won't respond and I have to go ctrl alt del.



I'm using Eclipse. I really want to test it… Any ideas?  :?

The advanced example also doens

Works here just fine…



Maybe give some more info, such as what you are experience, what you have tried (vehicle drives with arrow keys), what errors you are receiving, what OS, and jME version you are using…

I get this 2 erros when I start the sample:

ODE Message 2: cforce has NaN component! (…odesrcquickstep.cpp:772)

ODE Message 2: vector has NaN component (…odesrcodemath.cpp:138)



Win XP, CVS Version of jME

I got the exact same messages.



The program basically just freezes on the first frame. I get to see the car but it won't move and escape doesn't work either. Once I go CTRL Alt Del, the task manager shows that the program is not responding.



I'm using Vista 32 Home Edition. I got a snapshot jar of JME2 from the google code page.

Okay, so the issue is this:



        //debug: reproduce the NaN problem
        car.setPosition( 396.34573f, 5.2607946f, -3.0353582f );
        car.setRotation( -0.04183941f, -0.6998149f, 0.0071339696f, -0.7130623f );


In the testAdvancedVehiclePlus code, if I comment out those lines the test works (on OSX NaN problem doesn't appear...)


HOWEVER, there is something very strange with the wells then, in the attached image you can see the car wheels are not attached to the car at all...