Attaching ghostNode to a vehicle

Is there a way to attach things other than wheels to a vehicle?  I've got some ghostNodes that I'd like to attach to the front of a vehicle model I'm loading in, but I can't seem to find a way to do that.

Well… In bullet you can connect physics objects only via joints, but ghost nodes can't have joints… So effectively you'd have to move the ghost node to where the physics node is each frame…

But! In jme3 the ghostnode location is updated by the jme spatial location… So in theory it should be possible to simply attach the GhostNode as a normal child to the PhysicsNode and it should move with it (although one frame "late").

If you could try that and report if it works or if you have to move it by hand that would be cool.



Edit: Checked it and it works.

I've attached a ghostnode to the front of my car, but it seems to keep running into things that it doesn't look like it is running into.  The Logger keeps saying the ghostnodes are hitting the floor and the vehicle, when the model doesn't LOOK like they are touching anything at all. I know you said they would update a frame late, but even when sitting still I get this problem.

I have attached a ZIP file with the code so you might be able to run it to see what I mean. 

On a side note, in this file I've loaded  a model as my terrain, but the car keeps sliding sideways down the hills of the model, even when I set the friction high. Any idea how to stop that form happening?

Setting friction on the car only changes it for the chassis, you need to change frictionslip.  Setting frictionslip only works before adding the wheels, after adding use direct wheel access.

I tried changing the fictionslip before adding  the wheels. I set frisctionslip  to 10,000, 100,000 and even 1,000,000 but it has no effect. The car still slides sideways down the hills. It is at line 247 in the code of my original post.




        //Create four wheels and add them at their locations

        Vector3f wheelDirection = new Vector3f(0, -1, 0); // was 0, -1, 0

        Vector3f wheelAxle = new Vector3f(-1, 0, 0); // was -1, 0, 0

        Cylinder wheelMesh = new Cylinder(16, 16, r, r * 0.6f, true);


Any clue on that Ghostnode problem?

Nope, keep us informed about your discoveries :stuck_out_tongue:

Have you tried adding friction on each wheel?

Just after adding all the wheels and before adding the player to the rootNode, I set each wheels frictionSlip separately with the code below, but still no response from the vehicle.




I know this is an old thread, but i was curious as to any updates to the ghostNode system, or if anyone else is having this problem. I haven’t had any time to work on figuring out anything more. All I can say is that I’ve attached debugshapes to everything and it still looks as though nothing is touching the ghostNodes, yet they are still retuning collisions.