Spaceship physics

Doing my first jme project here which is a simple space shooter scroller. I am having some problems with the physics/collision stuff though.



I want the spaceship to follow the mouse on the screen/react to keys which I got to work with node.move. Then I introduced physics and use VehicleControl.applyCentralForce instead. I want the spaceship to stop when the mouse stops moving and I want it to stop att the screen border. Is there a better way to move the ship which would accomplish this?

Can you define what you mean by having the spaceship stop when the mouse stops moving? Like you want it to follow the mouse, but then stop when it has caught up to the mouse? Not sure what your specific needs are, or how much you actually were hoping to use true simulated physics, but another option is a character control. It has a vector for the walk direction, which you specify, in your case it could be a vector pointing from the ship to the mouse (in world coords), then normalize it and apply a mutliplier for acceleration and decceleration. This will be much easier to control and manipulate to follow specific rules (IE: world boundries), but I’m not quite sure it is what you are looking for.

I want the spaceship to be where the mouse pointer is so that when the pointer stops the ship stops instantly as when I did it with only spatials and move. I want the collision parts from physics but movements without physics. Also I want world boundaries for the ship but not for the other objects in the game. Will take a look at character control.

Yeah, you don’t want physics you want collision checks and then just move the ship yourself.

1 Like

Solved it by removing physics and did collision as per the HelloPicking tutorial. Thanks for the tipoff.