Implementing Physics on a loaded car-model


I want to make a racing game, however before I start with that I wanted to learn a bit, and after I saw that ( ) I thought I might use jMEphycis to controll the car, which would quite cool (for what I have in mind :D)

But I want to use physics on loaded car models.

So I've got a Car with 4 wheels, which I also can select (4 wheels are children of the car). Now I want to be able to addForce to those wheels, but I did not found out a way to do that.

I tried to add a wheel as a child to a DynamicPhysicsNode, but I don't get the Center of Mass into that Child's center.

Then I tried to create a Mesh (DynamicPhysicsNode.createMesh(String name)) and copy a Wheel (a TriMesh) to that created Mesh (PhysicsMesh.copyFrom(TriMesh mesh)), but that doesn't work. Its works if I create a Box (like in Lesson2) and then PhysicsMesh.copyFrom(that box), but it won't work with that wheel.

I don't even know whether its possible to do what I planned with the current version, so I better ask here, whethere someone has an Idea how to do it.

Basically I want to be able to do the same things which are done in the above mentioned thread, however I want to use a preloaded car to have these functions.

Hope you guys can help me out. Thanks.

I suggest making the car parent node dynamic, and adding forces to the whole car instead of just the wheels. You can make the wheels rotate anyways.

Yeah, I had it that way, before I wanted to addForce to the wheels instead, but maybe its not that a good idea anyway :smiley: