I’ve made a vehicle (a boat) using the PhysicsHoverControl from the TestHoveringTank example. (This class extends PhysicsVehicle and adds big low-friction wheels.) The player is modelled as a cylinder using a CharacterControl and stands in the boat.
The player can move around the boat fine. However, when the player moves the boat itself (using the .accelerate() method on the PhysicsHoverControl), the boat moves correctly while the player remains still. Eventually the boat catches on the immobile player and can’t move any further.
What’s the best way to move the player with the vehicle he’s standing on? PhysicsHoverControl calls applyForce() to move the vehicle, so I’m surprised the player standing on it doesn’t move too…
None really, set the walk direction or just don’t use a character when the player is boarded. You could apply the physics locally and have a copy of the boat in a separate static physics space, so the player actually walks on that while its just being moved by the vehicle node globally.
Thanks Normen. I’m not familiar with having multiple physics spaces - can you recommend any documentation?
Yeah, our wiki and the javadoc. Just set up two BulletAppStates. For local physics theres a test class in the jme tests.