Parenting Physic objects

Well i know this is not directly possible with Jbullet, but I need a way to simulate/emulate it kinda



What i have: A Player running in a spaceship having simple collisions disallowing him to warp through walls.

But also I want the spaceship to collide with other spaceships were are also people onboard. While the spaceships msut have real collision the player is enough to have a kinda simple one (still I have no idea how to create/get a simple one?!?)



All of my objects have a visible model wich is not important here, a low poly model for internal only collision(player-ship) and a very simple for outer collision(ship-ship)

Hm, you could use PhysicsCharacterNode for that. It does not slide on a steep floor (which is probably what you want to avoid) but it still collides and has a gravity simulation, dont know if it will "follow" the ship, maybe it wil slide away under it…



Edit: Possiibly the simplest way is to have no real physics for the characters but moving them across the floor "manually" as you would without physics.

Yes, I thought about that, but I have the problem how can I determine stuff like stairs/ small gangways then properly?

What exactly do you mean? You could cast a ray from the character to determine where the floor is.

Yes, I already thought a bit about it, I guess i can try to implement it by more or less getting the intersections with all neighbour elements (in my case all internal collision shapes in the same ship), and if it intersects. The players collision shape will be a Cylinder.



(Geometry.collidesWith(Geometry,res); //Jme3 will be used

res.getClosestCollision().getContactNormal()



Then use that normal to create a slide alog the wall for the player.



In case of a contact with a  ceeling(closest contact point above player center) zero the Y change value (aka jumpin stops on ceeling)



Lower Player Y every tick by gravity acceleration.(to amke sure he will fall down back)



In case of contact with Ground set the Y to a very small so he bounces a bit out of the ground


  • A ray around one step forward and maximum stepsize higherstarting downwards to test if there is something the player can step onto. or if it is too steep.





    What you think about this concept? Can it work that way?

Sounds valid, maybe you can emulate the ship's gravity by checking its world rotation each frame and then applying the local -y direction to all characters on board until they collide with the floor again.

Well idea is that I actually parent the Players on the thing they are walking on, (so their ship or a planet surface)

So I can completly ignore what they are walking on i only need to know the collisionshapes of their direct parent.



For simpilicty I just assume that all ships emulate earth gravity always,as it will probably be annoying in ship boardings when you get thrown around cause the pilot goes crazy ^^. (Fun > Realism)

D'oh, of course, they gonna be child spatials anyway XD I'm stuck thinking in world coordinates with all this jme3 physics work 

Well I kinda think of throwing a real physic system completly overboard, If i find a close enough calculation for the ships, as it will make things like landing on a astroid, or in another ship far simpler. But first the player, still worth a try I guess. Also i kinda assume that it will need far less memory and cpu power, and I don#t really need real physics anyway,

I need only a collision detection. (Two ships could be bounced away after colliding depending on there total mass in relation to the other ship (kinda like freelancer works) As it seems the collision detection in Jme3 has greatly improved allowing far more stuff to be done with the collisionresult.

Only thing that will be sacrificed really is that ships get rotated depending on points of impact, maybee I find a way to approximate that as well without to much overhead.

Its true that its simpler most of the time to do stuff directly, in most games physics is not used for everything all the time but just in certain moments, e.g. when a npc dies it goes from animation mode to physics ragdoll mode by attaching the limbs to a cached physics ragdoll.

Hm can it bee that in JME