Applying forces with the mouse

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.

Do you know the physics picker used in many of the tests? Try to drag and drop a physical object in some test (e.g. TestDomino). Is this the effect you are after?

The PhysicsPicker uses joints. Maybe you can build upon that concept.