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.

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
    web
    Customer

    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?

    #24900

    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

    Chief 3D Verger | LinkedIn | Twitter

    #24914
    web
    Customer

    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

    yes, I think it should be possible with JavaScript

    Chief 3D Verger | LinkedIn | Twitter

    #24960
    web
    Customer

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

    #24987

    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.

    Chief 3D Verger | LinkedIn | Twitter

    #24993
    web
    Customer

    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

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

    Chief 3D Verger | LinkedIn | Twitter

    #24998
    web
    Customer

    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.

    #25000

    didnt work for me in the prepareExternalInterface function

    try making it inside runCode()

    Chief 3D Verger | LinkedIn | Twitter

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