Search the Community
Showing results for tags 'viewpoints'.
-
Hi, I would like to understand a strange behavior of my camera and how to prevent it. Let me explain. I have a mesh that I like to see from different point of views with an ArcRotateCamera. If collisions are enabled, if the camera move from viewpoint1 to viewpoint2 and the translation between these 2 points intersects the mesh, the new camera position is not the expected one. If collisions are disabled, it works. If the translation doesn't intersect the mesh, it also works. Here is a PG to illustrate my issue : you can change viewpoints by pressing keys '1', '2', '3', '4', '5' or '6' to see respectively the cube from front, left, back, right, top or bottom viewpoint you can toggle collision by pressing 'c' If collisions are enabled, my issue happens when : switching from opposite viewpoints (1 -> 3, 2 -> 4, 5 -> 6), you obviously intersect the cube if you are close enough of the cube, moving to any viewpoint will intersect the cube and pressing consecutively the same key will not have the same result until the camera is not in the intended position If collisions are disabled, camera's behavior is the expected one. I don't know why my camera moves like this. I assume that the camera is not teleported from a viewpoint to another but it is translated which implies a collision with my mesh. Can it be fix in Babylon.js ? Do I misuse the library ? How can I prevent this behavior ? I succeed to avoid it but I have to use window.setTimeout twice to disable collisions, then move my camera and enable collisions. function setViewpoint(viewpoint) { camera.checkCollisions = false; window.setTimeout(function() { camera.alpha = viewpoint.alpha; camera.beta = viewpoint.beta; window.setTimeout(function() { camera.checkCollisions = true; }, 100); }, 100); } It is a bit tricky and I'd like to find another way to do it. Thanks
- 2 replies
-
- arcrotatecamera
- collisions
-
(and 1 more)
Tagged with: