Hello, I have this problem, I need to change the mouse cursor position when it is invisible, but if I set
inputManager.setCursorVisible(false) then I can’t manage the mouse though the org.lwjgl.input.Mouse anymore.
I’m trying to replicate this Dead Space - Perfect Asteroid Run - YouTube, I need to change the mouse position when it goes out the window’s border to put it back inside the border.
this is my update code
obbiettivo is the Vector obtained from the intersection between the Ray that start from the mouse and the wall used as the start point for the meteorites
arrow is used as the cannon’s laser
thank you for your help and sorry If I made any English mistake
@Override
public void update(float tpf) {
super.update(tpf); //To change body of generated methods, choose Tools | Templates.
CollisionResults results = new CollisionResults();
Ray ray = new Ray(new Vector3f(0,inputManager.getCursorPosition().getY()-(settings.getHeight()/2), inputManager.getCursorPosition().getX()-(settings.getWidth()/2)), new Vector3f(600, 0, 0));
rootNode.collideWith(ray, results);
if(results.size()>0){
obbiettivo = results.getClosestCollision().getContactPoint();
}
cannonNode.lookAt(obbiettivo, Vector3f.UNIT_Y);
arrow.setArrowExtent(obbiettivo);
if(inputManager.getCursorPosition().getX() <= 190){
Mouse.setCursorPosition(191,(int)inputManager.getCursorPosition().getY());
}
if(inputManager.getCursorPosition().getX() >= 1089){
Mouse.setCursorPosition(1089,(int)inputManager.getCursorPosition().getY());
}
if(inputManager.getCursorPosition().getY() >= 615){
Mouse.setCursorPosition((int)inputManager.getCursorPosition().getX(),615);
}
if(inputManager.getCursorPosition().getY() <= 207){
Mouse.setCursorPosition((int)inputManager.getCursorPosition().getX(),207);
}