We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Clicking camera movement in first-person mode

Home Forums Puzzles Clicking camera movement in first-person mode

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #47115
    sireon
    Participant

    Hello. How to implement camera movement by click in First-Person mode? On the computer by default – WASD, I would like the character to move by mouse click or tap (on touch-screen devices). I would also like the camera to keep looking where it was looking before it was moved.

    #47154
    sireon
    Participant

    Implemented as follows. The only thing I could not implement a smooth movement of the camera from point A to click point. There is a node “tween camera to”. But I don’t understand what to put in “look at” input.

    Attachments:
    You must be logged in to view attached files.
    #47162

    Hi,

    The “look at” parameter specifies a 3d point where the camera should look at after the movement is done. If you want to keep the camera’s orientation the same then you can calculate the “look at” parameter by adding together the camera’s current direction/orientation vector and the new position to move to.

    I attached a test demo, where you can look around via the left mouse button and move by clicking the plane with the right mouse button.
    Hope this helps!

    Attachments:
    You must be logged in to view attached files.

    Co-founder and lead developer at Soft8Soft.

    #47197
    sireon
    Participant

    Hi,

    The “look at” parameter specifies a 3d point where the camera should look at after the movement is done. If you want to keep the camera’s orientation the same then you can calculate the “look at” parameter by adding together the camera’s current direction/orientation vector and the new position to move to.

    I attached a test demo, where you can look around via the left mouse button and move by clicking the plane with the right mouse button.
    Hope this helps!

    Thank you!

    #48562
    AVerge3Der
    Participant

    This is great. Thank you for sharing Ivan.

    (Future self->See the example project in the above post)
    (Mouse right-click and move the camera to that spot sample code) :yahoo:

    #63692
    niklasber
    Participant

    How can I open your attached zip file in verge3d? So I can have a look on the code blocks.

    #63856

    How can I open your attached zip file in verge3d? So I can have a look on the code blocks.

    Hi, you can unpack it manually into Verge3D’s applications directory. After that it should appear in the project list in the App Manager. Then you can open it in the Puzzles Editor and check the code blocks.

    Co-founder and lead developer at Soft8Soft.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.