Physics and First Person Shooter

I've read a lot of the threads about implementing the first person handler with some physics, but it looks like a lot of tweaking which I don't really feel up to.  I know how jme already has bounding spheres and stuff, so I was wondering if there was a way to integrate a character without physics, but still be detected by collision detection of the physics engine.  I know this sounds like a complete waste of a physic engine, but what I also want to add such things as grenades and vehicles that would take physics.  Hopefully you catch my idea.  This is sort of how I think Halo 1 is made, but the body goes ragdoll after death.  So what I want to know is whether I can use the physics collision detection side by side with the jme bounding spheres, or do I have to use a dynamics physics node to uses physics?

Well, I guess you could have a 'fake' physics node that represents the character and poll for its position, velocity and acceleration; then update the non-physics character.  But that might be more difficult than actually just using the physics, additionally it seems like a good spot for a measurable performance loss.

What about bullet since I've heard this physics engine doesn't have Continuous Collision Detection, I would want to do bullet that do ray casting outside of the physics engine that have their own collision detection.  Would they the bullets with ray casting be able to detect physics nodes?

SomethingNew said:

I've read a lot of the threads about implementing the first person handler with some physics, but it looks like a lot of tweaking which I don't really feel up to.  I know how jme already has bounding spheres and stuff, so I was wondering if there was a way to integrate a character without physics, but still be detected by collision detection of the physics engine.  I know this sounds like a complete waste of a physic engine, but what I also want to add such things as grenades and vehicles that would take physics.  Hopefully you catch my idea.  This is sort of how I think Halo 1 is made, but the body goes ragdoll after death.  So what I want to know is whether I can use the physics collision detection side by side with the jme bounding spheres, or do I have to use a dynamics physics node to uses physics?

It would take about 3-5 times longer to implement the bounding sphere method than the physics-based method.

SomethingNew said:

What about bullet since I've heard this physics engine doesn't have Continuous Collision Detection, I would want to do bullet that do ray casting outside of the physics engine that have their own collision detection.  Would they the bullets with ray casting be able to detect physics nodes?

That's what PhysicsRay is for. See the PhysicsPicker class for an example usage.

I tried attaching a cameranode to the physics node I was using to wander around:



   camNode = new CameraNode( "Camera Node", display.getRenderer().getCamera());

   NodeRotationHandler cameraHandler = new NodeRotationHandler( rotationController, 1);

   input.addToAttachedHandlers(cameraHandler);

   input.addToAttachedHandlers(new NodeRotationHandler( camNode, 1));

   player.attachChild(camNode);



player is my DynamicPhysicsNode built up of cubes..

Nothing beats attaching a camera node to a physics node with translation facing it, then using the physicspicker to pick up the object on your physics node and shake yourself around though.. :)

This solution made me queasy as my character's motion wasn't very smooth. I got as far as moving around and firing a physics projectile in the direction the player's staff was pointing, but gave up.. The code is a mess, but you're welcome to it.. Might do for a basic jeep with grenade launcher though.

Thanks for the help guys, I think I going to do a Dynamics Physics Node and always keep it upright and use addForce() to move it, but for rotation I will do myself since my model is a little more complicated then just one rotation quaternion and I don't want to rotated the whole body when I move the mouse in FPS, just rotate the parts I want.