Jump to content

Questions on ArcRorateCamera and PhotoDome


ilia
 Share

Recommended Posts

Hello everyone, this is my first post here, so please don't be too harsh on my mistakes! Just started with Babylon JS a few weeks ago...

I'm trying to build a concept showcase based on Babylon JS - will eventually create a link in the Demos and Projects section next wheek when something reasonable becomes available.

The goal is to create a hierarchical data definition and data presentation system (where one can create the definitions of data items and the relations between them) and than can start using these to input real data. Like defining the META descriptions of a GraphQL-like system and the imputing and visualizing the data.

As per the specs the data elements can reach tens of thousands for a single "entry", would like to try building this into the 3D space for faster browsing, zoom-in and out of detail levels, moving back and forth through a chain of similar items and so on.

And for a rough guideline on what is to be modeled - consider the 3D representation in the Homeworld games.

Well, this actually should go to the entry in "Demos and Projects"..


And the actual questions now:


1) After an ArcRotateCamera's positions is animated, it stops to respond to mouse wheel. Here is a snipped of the animation (sorry for not creating a Playground, will learn to do this, tоo):

function _3d_camera_move_animate(from, to) {

    var a = new BABYLON.Animation(
        'camMoveAnimate',
        'position',
        60,
        BABYLON.Animation.ANIMATIONTYPE_VECTOR3,
        BABYLON.Animation.ANIMATIONLOOPMODE_CONSTANT
    );
    a.setKeys([
        {frame:0, value:from},
        {frame:100, value:to}
    ]);
    CAMERA.animations.push(a);
    SCENE.onBeforeRenderObservable.add(_3d_camera_force_rebuild);
    SCENE.beginAnimation(CAMERA, 0, 100, false, 10.0, function() {
        SCENE.onBeforeRenderObservable.remove(_3d_camera_force_rebuild);
    });
}    

function _3d_camera_force_rebuild() {
    CAMERA.rebuildAnglesAndRadius();
}

 

2) The moving above is used to move the camera after an object is selected and this relates to the next question:

If you have the positions of 2 objects and the camera, how to calculate how to move the camera to the side, to give the impression that when you select the second object it starts to face it, while it was facing the first object before that. The actual problem is that if the camera is moved equally to the distance between the 2 objects, this is too much - as the objects are away from the camera and the "observable" distance is far less that the actual one.


3) How to prevent the camera of exiting a PhotoDome? For example when using the mouse wheel...


Sorry for the lengthy post...


Best regards,
ilia.


 

Edited by ilia
Added tags.
Link to comment
Share on other sites

Hi @ilia welcome to the forum!

You can navigate here to create a playground: https://playground.babylonjs.com/

You can create a simple scene with the playground to repro the issue you are having, then click the "Save" button.  The url should then be updated.  You can post the URL here and we can help investigate the issue you are hitting.

Let us know if you are having issues with setting up the playground.

 

2. Perhaps you can use a rotation quaternion and "slerp" between the two objects using a Quaternion?  Here are some docs on animations: https://doc.babylonjs.com/babylon101/animations#controlling-animations

 

3. You might be able to trigger a callback on scrolling to check the distance from the center of the photodome.  If you are too far from a set distance you can cause the scroll to not move the camera. 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...