Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setFPSCamera method of GameScene in input events #1189

Closed
AlmasB opened this issue Jul 22, 2022 Discussed in #1185 · 0 comments
Closed

setFPSCamera method of GameScene in input events #1189

AlmasB opened this issue Jul 22, 2022 Discussed in #1185 · 0 comments

Comments

@AlmasB
Copy link
Owner

AlmasB commented Jul 22, 2022

Discussed in #1185

Originally posted by feiniao5643 July 20, 2022
First of all, please forgive me for my bad English.
I'll skip the usual preliminaries and come straight to the point.
I use this API in initGame,It's normal.
@Override protected void initGame() { camera3D = FXGL.getGameScene().getCamera3D(); FXGL.getGameWorld().addEntityFactory(new GameEntityFactory()); camera3D.setMoveSpeed(500); camera3D.getTransform().setZ(-200); camera3D.getTransform().setAngle(30); **FXGL.getGameScene().setFPSCamera(true);** FXGL.spawn("铁骑兵",0,0,0); }
But I can't use it in mouse events.
`FXGL.getInput().addAction(new UserAction("Mouse Turn") {
@OverRide
protected void onActionBegin() {
FXGL.getGameScene().setFPSCamera(true);
}

        @Override
        protected void onActionEnd() {
            System.out.println(0);
            FXGL.getGameScene().setFPSCamera(false);
        }
    },MouseButton.SECONDARY);`

Finally, the function I want to achieve is that when the right mouse button is pressed, the camera moves with the mouse, and the camera is fixed after release.

@AlmasB AlmasB closed this as completed in 804e331 Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant