Buggy demo

the buggy doesn’t seem to handle sideways movement i.e drift, power sliding or cornering on the whole very well is that deliberate for the test or is that stuff still WIP because the vehicle flips easily even at low speed or is a setting that can be adjusted to manage this.



thanks in advance

Well, the answer for this is complicated, let me try and explain.



First of all, because are are approximating the wheels to spheres, that means the spheres only have one contact point on the terrain, as opposed to a proper tyre (i.e cylinder), it has many contact points.



Second of all, the buggy is actually quite tall (if you take the bounding box of it, which we are) and basicaly, its acting like a double decker bus with those types of wheels.



Third, friction can be changed to have drifts/power sliding even a burn out! Simply set an empty contactAction on terrain, and for every wheel, copy/paste the code in the defaultContactAction and set the friction coefficient (Mu) to be around 0.95 or even less, which ever takes your fancy. And you have power slides! But again, because the model is so tall, its gonna be unstable.



DP

Second of all, the buggy is actually quite tall (if you take the bounding box of it, which we are) and basicaly, its acting like a double decker bus with those types of wheels.


lowered the chassis on against the wheels already I suppose scaling it to give a wide body effect may also help


First of all, because are are approximating the wheels to spheres, that means the spheres only have one contact point on the terrain, as opposed to a proper tyre (i.e cylinder), it has many contact points


bounding cylinders perhaps, but a request for mojo that is!!

Third, friction can be changed to have drifts/power sliding even a burn out! Simply set an empty contactAction on terrain, and for every wheel, copy/paste the code in the defaultContactAction and set the friction coefficient (Mu) to be around 0.95 or even less, which ever takes your fancy. And you have power slides! But again, because the model is so tall, its gonna be unstable.


thank you very much and noted
"DarkProphet" wrote:
Third, friction can be changed to have drifts/power sliding even a burn out! Simply set an empty contactAction on terrain, and for every wheel, copy/paste the code in the defaultContactAction and set the friction coefficient (Mu) to be around 0.95 or even less, which ever takes your fancy. And you have power slides! But again, because the model is so tall, its gonna be unstable.

I just tried this out (using the CVS HEAD as the basis) but it doesn't seem to work very well. There are a couple of changes I made:

1. changed the buggy from 4wd to 2wd (rear wheel drive that is, there's no way yet to simulate front wheel drive cars as far as I'm aware).
2. I've set the contact action of the "floor" like this:

        obj.setContactAction(new ContactAction(obj) {
            public void onContact(PhysicsObject other, Contact contact) {
            }});


3. I've set the contact action of all four tires like this:

            ContactAction contactAction = new ContactAction(wheels[i]) {
                public void onContact(PhysicsObject other, Contact contact) {
                    contact.setMode(Ode.dContactBounce | Ode.dContactApprox1);
                    contact.setBounce(0.4f);
                    contact.setBounceVel(1f);
                    contact.setMu(0.95f);
                }
            };
            wheels[i].setContactAction(contactAction);



The car I now get has trouble rotating its front wheels at all and feels very underpowered.

I'm new at jME and ODE, so tell me if I'm doing things wrong. I just tried to follow the instructions on this one and I'm not getting the results I expect. :)

no, your getting the right results. I know about all the bugs and im actually working on removing ContactAction all together and replacing it with something alot better…stay tuned.



Also, the rear wheels sometimes break out of their min/max angles, this is because we aren’t using AMotors, we’re using velocity, and ode doesn’t like that.



Now for some good news. The car stuff is being tuned and tweeked so that you always get the right stuff. There are still alot of bugs to iron out and thanks for your feedback.



DP

Thank you for your quick response! I’ll be testing the car physics (I already setup the CVS HEAD in Eclipse) the upcoming weeks, and will study the ODE physics some more too. I very much like the idea of providing such high-level objects as cars.



Btw, how realistic would it be to load some kind of scene (rally stage, track, …) and make the car drive on that?

well, the hardest part is going to be the networking (for a multiplayer game) or the AI (single player).



It is very releasing, all you have to do is get your AI/networking to do the steering/stopping/acceleration.



Basically, create a static physics object as your terrain, create new cars as players emerge and let them add/remove steering. Thats all there is to it.



Btw, speaking of multiplayer car games. Except a quadbike game to be started as a quadbike game sometime in may.



DP

marrs, awesome that you’re interested in the vehicle code - we really need someone to take care of that part. I wouldn’t say it’s ready to go into a game yet - full vehicle support is planned for v.06. There’s a couple of TODO’s laying around in the code, and you should also check out the car test (jmextest.physics.vehicle.TestCar). Currently it has cylinders to represent the wheels, so it should be a bit more stable. Also it looks very strange, because the wheel model isn’t rotated correctly, hehe :slight_smile:

"Per" wrote:
and you should also check out the car test (jmextest.physics.vehicle.TestCar). Currently it has cylinders to represent the wheels, so it should be a bit more stable. Also it looks very strange, because the wheel model isn't rotated correctly, hehe :)

Agreed, and it too does not seem to work well when you switch from 4wd to 2wd. But I'll have a better look! :)