Example of Car or Vehicle?

Hello,



does an example exist where the class Car or the Vehicle class of jme physics is used? In the TestVehicle that I found in the physics source is a chassis and 4 wheels but nothing moves. I really would like to see how to use setGasPedal() and the other Car functions. I read of a buggy game in the forum but I can't find it. Is this downloadable with source? Or another game (or an example) with source code?

BuggeDemo is the thingy with the buggy - it's in jME Physics CVS on sourceforge.

This is not for jme-physics 2, is it? That would confuse me even more, if I tried to use this version because I started with 2.

Is there an exmaple for version 2 beta?

oh, ok. There is a very simplistic one, yes: TestVehicle



But there are no sophisticated examples for jME Physics 2 yet :frowning:

Yes I mentioned TestVehicle. My problem is that I don't know how to create a Car of the da. All the tires are made in a loop but how can I use them in the constructor of Car? Because there is an array of DynamicPhysicsNodes necessary. Does it help if I don't do it in a loop but every wheel? But then I have the problem that I don't know how many axisses (is this the word - I am form germany, sorry for bad English) I have to use.



I also wonder why nothing happens when I press the keys that are used with the InputHandler. Shall there move anything or what function have these?



I wouldn't get on your nerves that much if I would have an example, so it would be very nice if you could programm a simple (I know that simple is relative as we saw yestrday  ;)) class that creates a Car that I can handle with setGasPedal and with the other functions I read.



Hoping for help, Jan…

daryl said:

I also wonder why nothing happens when I press the keys that are used with the InputHandler. Shall there move anything or what function have these?

The example 'car' can be steered with the numpad, yes. On linux you have to switch on Num-Lock.


Regarding an actual Car class. That really depends on the stuff you want in your application. And those points you question are really only java or general programming related. The examples that I want to write will focus on actual physics modelling. But maybe someone else can help you out there...

Strange, nothing moves on my screen. I also attached some other keys to the action but there is no reaction either. I use Windows but that shouldn't be the problem.

I've had problems with the BuggeDemo in the past where the vehicle won't move until you shoot it with a ball…not sure exactly why that is but every now and again it's like it's "stuck" and the only way to break it free is a light tap by the ball shooter.



darkfrog

There seem to be no ballthrower in jmephysics2 yet, darkfrog.

So better not tell newcomers to throw their balls at cars to break them free  :smiley:

I really enjoy these exchanges between you guys and the frog :smiley: XD XD

I guess I'm the forum clown. :-p



Oh, haven't had an opportunity to play with v2 much yet.  I was referring to the v1.



PS - winkman, you're a sicko!



darkfrog

daryl said:

Strange, nothing moves on my screen. I also attached some other keys to the action but there is no reaction either. I use Windows but that shouldn't be the problem.

hold down the acceleration key (NUM_8) quite a while - the vehicle should really move. If no - does it fall on the ground?

I did but nothing moves. Yes it falls on the ground and stays there. I also included a System.out.println("yes"); in the performAction() method to see whether this method is executed by pressing the key but that doesn't work either. And the mistake isn't my keyboard - I first thought that NUM-keys don't owrk so I assigned KEY_Z for example but the result is the same.



PS: Or do I have a too old dll or a jar? I wonder that on your linux it works and on my Windows not - is anyone here running windows and being able to move the car of TestVehicle?

I'm on windows, too. And the beta1 download from java.net should work fine - so it shoudn't be too old.

darkfrog, i'm sorry, i couldn't resist writing this, still had tears (from laughing) in my eyes imageining You throwing balls at the poor car

I've had problems with the BuggeDemo in the past where the vehicle won't move until you shoot it with a ball...not sure exactly why that is but every now and again it's like it's "stuck" and the only way to break it free is a light tap by the ball shooter.


http://ode.org/ode-latest-userguide.html#sec_12_13_0 I think this addresses the "stuck" problem. I had this issue and I added a line in update() to fix it something like

chassis.addForce(new Vector3f(0,0,0));


it just constanly applies an unnoticable force to car to keep it from freezing, not the best fix but easy and it works.

It takes a LOT more than that to offend me…you should hear some of the things Mojo has said to me. :-p



I take it all in good fun…it would be pretty funny though if people were sitting in front of their computers bouncing balls off their screens trying to get the game to work…



darkfrog

Hi Daryl !!



I had problem with TestVehicle downloaded one month ago too.

Only one tire is created with for ( int i = 0; i < 1; i++ )  change it to i<4;

The game test is paused by default. press p to make it play or erase the program line pause = true !



This VehicleTest is a very good example and works fine. We'll have to wait for Tgiant to finish Vehicle and Car implementation in JME Physics 2.0 to make it easier !!



PS: Never trust DarthFrog, I didn't code a line of his life.  }:-@ :smiley:

and delete this line if you want your vehicle to fall on the floor ::

getPhysicsSpace().createJoint().attach( chassis );



  :smiley:

You're just upset because I figured out that what you're wearing upon your head is the helmet of mambrino…or maybe you're just mad because you don't understand the reference.  :stuck_out_tongue: