godot icon indicating copy to clipboard operation
godot copied to clipboard

Godot ignores sequential camera rotations in 3d.

Open Einlander opened this issue 10 years ago • 2 comments

In my project I have 2 camera rotations in a row. Godot will execute the first one and ignore all the rest for that frame.

Godot Version: Godot_v2.0_alpha_20151030_win64.exe Os: Windows 7 Pro 12GB Gfx: Radeon R9 270x 2GB x2 no crossfire Driver: Radeon Crimson 15.12

The entire project: https://mega.nz/#!9QlyFAzZ!uYYmrc4C3kia1MMG5ZRCME_p2h_bVsFqNrMuC0aUO9k Just the code: https://gist.github.com/Einlander/4a408e91679d32a9c063

Einlander avatar Feb 11 '16 07:02 Einlander

That's not a bug in Godot from what I can see, but in your code :) (btw you forgot to include the script in the entire project, but hopefully it's easy enough to copy from your gist ;)).

Camera.set_rotation() will define the absolute rotation of the camera, so if you run it twice in a row, the first one just gets discarded.

So you need to replace your code with:

        self.set_rotation(Vector3(deg2rad(pitch), 0 , 0))
        self.set_rotation(self.get_rotation() + Vector3(0, deg2rad(yaw), 0))

or

        self.set_rotation(Vector3(deg2rad(pitch), deg2rad(yaw) , 0))

akien-mga avatar Feb 11 '16 07:02 akien-mga

Thanks

Einlander avatar Feb 11 '16 07:02 Einlander