javascriptthree.jsmodelperspectivecamera3d-model

Is There Any Way To Avoid Camera Passing Through the GLtf Objects That loaded Inside Our Scene In ThreeJs


hey there I am working with Threejs and I want to develop an online virtual tour. So I loaded some 3d objects as Booths and a camera with a PointerlockControl and everything works fine but the problem is that the camera will pass through the objects and I think that is not good.is there any way to avoid this issue ?


Solution

  • So the problem is that the camera is sometimes inside an object and you can see this object from inside (which doesn't look good)? If so, there are two basic solutions:

    1. You can create an objects collision system to detect a camera <=> object collision.
    2. A much simpler solution: just set your objects' material like this: Material.side = THREE.FrontSide, so the camera will be still able to go inside an object, but this object will be not visible from inside (if that's your problem).