Scaling & raycaster issues (breaking changes after updating to new Three.js & React Three Fiber versions)

22 Views Asked by At

The app worked fine with ("react-three-fiber": "^5.3.14) and (three": "^0.148.0) together with ("react": "^18.2.0").

Now, I'm using ("@react-three/fiber": "^8.15.15") and ("three": "^0.160.1") together with ("react": "^18.2.0")

Now the scaling seems weird. The scene looks much smaller from the existing camera angle. It seems scaled down a lot.

I'm still using the ordinary Three GLTF loader from three/examples/jsm/loaders/GLTFLoader.js I'm also using an ordinary Three.js Raycaster.

But, the worst problem is that there seem to be a wrong correlation between the visible geometry and the world positions I get from the raycaster.

It it possible to change the scale the scene, to make it look better.

But, when I try to set the position of perspective camera with new values I get from the raycaster, but those values seems to be completely scaled wrong related to the visual geometry.

I use the global scene as input to the Raycaster and I set the Raycaster from both a Vector3 and the mouseinput 2D coordinate (for two different kind of functionallities).

I was expecting that the world values from the Raycaster would at least be in the same range as the visual geometry but they seem to be unproportionally scaled.

I have been using quite much useRef to manipulate the positions and scale and set positions and scale with for example

position={new Vector3( 

. That worked fine in previous version. Could that be the cause of the errors?

0

There are 0 best solutions below