Best way to switch between camera options

Home Forums Puzzles Best way to switch between camera options

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #24871
    Avatarweb
    Licensee

    I having a hard time to implement a good working “camera switching” in my application.

    I need to implement switching between different camera options triggered by the user:
    – Camera with only orbit (limited angles) and zoom allowed no panning
    – Camera with orbit (still limited angles), zoom and panning.
    – “2D” locked camera. Just top viewing with no orbit, just zoom and panning.

    Because as far as I know its impossible at the moment to change camera settings at runtime. I created different cameras. I can switch between them, but I’m having a hard time to get a smooth transition between the cameras. I get strange jumpings, etc. I just want the change between the cameras become “invisible”.

    I would also be okay with creating camera programtically, but I couldnt find any information in the developer api to set options/limits for a perspective camera.

    Any ideas?

    • This topic was modified 1 week ago by Avatarweb.
    #24900
    Yuri KovelenovYuri Kovelenov
    Developer

    Hi,

    I get strange jumpings, etc. I just want the change between the cameras become “invisible”.

    likely the problem is that when you switch between cameras, the current camera position does not fit in the limits imposed by the previous camera. A possible solution may be that you smoothly reset the camera to some predefined ‘safe’ position before switching it

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #24914
    Avatarweb
    Licensee

    Hmm okay, will have a look.

    Can you tell me if it is possible to create a camera directly in javascript with limits/restrictions?

    #24945
    Yuri KovelenovYuri Kovelenov
    Developer

    yes, I think it should be possible with JavaScript

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #24960
    Avatarweb
    Licensee

    I already saw that entry, but I couldnt find description in the api to set camera limits.

    #24987
    Yuri KovelenovYuri Kovelenov
    Developer

    Sorry, the right page is
    https://www.soft8soft.com/docs/api/en/controls/OrbitControls.html

    you should use app.controls to access these properties and methods.

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #24993
    Avatarweb
    Licensee

    Thx, this looks promising.

    Do you have to create the camera object pure in javascript or can you get a scene camera and alter the settings?

    #24995
    Yuri KovelenovYuri Kovelenov
    Developer

    EDIT
    Controls are changed independently from the camera, e.g.
    app.controls.minDistance = 2

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #24998
    Avatarweb
    Licensee

    Got it.

    app. didnt work for me in the prepareExternalInterface function. Got undefined error for “enableZoom” for example. But implementing a function into the “visual_logic.js” via appInstance.controls.enableZoom = false did work for me.

    • This reply was modified 4 days ago by Avatarweb.
    #25000
    Yuri KovelenovYuri Kovelenov
    Developer

    didnt work for me in the prepareExternalInterface function

    try making it inside runCode()

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.