Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Rotate a 1st person camera — Gideros Forum

Rotate a 1st person camera

Hi there!
I'm new to Gideros and documentation is way too confusing.

How one is supposed to place a movable and rotatable camera in a 3d environment?
image
I've tried viewports and rotating the root sprite but it took me nowhere.
Movement is not a big deal, but rotation performs weird tricks.
(see attachment)

What I want to know is how to make camera rotate around itself and not around some weird point in 3d world.
It's important to not rotate the "stage" node since the text like coordinates should be available at all times.

Regards!
zip
zip
3dtest.zip
41K
3dtest.png
502 x 375 - 137K

Likes: MoKaLux

Tagged:
+1 -1 (+1 / -0 )Share on Facebook

Comments

  • hgy29hgy29 Maintainer
    edited April 2018 Accepted Answer
    Hi @4aiman,

    I've rewritten your main.lua so that it does what you want (well I hope thats what you want). The key is to use a Viewport as camera, it has a lookAngle() function to setup the camera position and angles. You should also forget about application:configureFrustum(), as it will apply to everything on stage, even texts or UI. Configure the projection directly in your Viewport, then scale/place the viewport in your 2D stage.
    lua
    lua
    main.lua
    4K
    +1 -1 (+4 / -0 )Share on Facebook
  • Thanks a lot, hgy29! :)

    Likes: MoKaLux

    +1 -1 (+1 / -0 )Share on Facebook
Sign In or Register to comment.