I'm looking for a way to move an object using forces taking into account the position of the mouse. Currently I just move the object with translations using the mouse position. Below is the current code I use (I found it in another forum post):
//PlayerController.java
private Node playerModel;
@Override
public void update(float time) {
mousePosition.set(MouseInput.get().getXAbsolute(), MouseInput.get().getYAbsolute());
float xDirection = xSensitivity * (mousePosition.x - centerPosition.x);
float yDirection = ySensitivity * (mousePosition.y - centerPosition.y);
playerModel.setLocalTranslation(xDirection, playerModel.getLocalTranslation().y, -yDirection);
}
Any help would be appreciated.