0
votes

I am trying to do a navigation system like google cloud infrastructure like this:

google cloud infrastructure.

I want to do this using aframe rather than threejs. So I am now customising aframe orbit control by keven ngo:

aframe orbit control.

The problem is that, I succeeded in limiting the auto rotation in a certain angle, so as pan. But I have some following problem that I do not know how to do after searching every posiblities and tried my self:

  1. how to achieve the same effect of bouncing back smoothly after reaching out the pan limit;
  2. for some reason if I pan and after mouseup then when mouse moves, it still pans rather than rotate. Why is that?
  3. how to make camera rotates slightly like in google's example(I modified the original library to rotate camera when mousemove rahter than mousedown)?

Below is the glitch link of my experiment:

aframe customized orbit control

what I customized(I notated my change with slashes and ADDITION text):

  1. autorotates between set angle;
  2. mouse click only pans; when mouse move, camera rotates and autorotate stops;
  3. pan can be limited.

This is a long question, very appreciated if anyone can help!!

1

1 Answers

0
votes

how to achieve the same effect of bouncing back smoothly after reaching out the pan limit?

One idea: on mouseup (ie release of pan mode), check if the camera target is outside of the camera's viewing frustrum. If so, calculate a new target position, say half way between current target position, and a point in line with the camera z axis( ie, the center of the screen). Then make an animation, that moves the camera target from current location, to new location.

for some reason if I pan and after mouseup then when mouse moves, it still pans rather than rotate. Why is that?

It seems that the navigation mode (panning, orbitting,or zooming), does not change on mouse up. Make a new (mouseup) listener, that forces orbit mode back to a default mode (orbit?).

how to make camera rotates slightly like in google's example(I modified the original library to rotate camera when mousemove rahter than mousedown)?

It looks like in the google example, orbit direction is determined by which side of center the cursor is in. Left side makes autorotate go clockwise, and right side counterclockwise. You will need to use the cursor component to detect this, and change the orbit direction accordingly. Also, it appears that in the google version, orbitting is not determined by mousedown (ie dragging), but by cursor distance to center, and this is added to the auto rotate. It appears to be a buffer system, where distance to center initially creates a value to alter the auto orbit (by adding or subtracting to the orbit amount), but that value is a buffer, meaning that it degrades to 0 over time (each frame the value is reduced slowly to 0).