Reverse rotation.

I am placing Object3Ds in a scene with coordinates from an older Away3D project. The problem I'm running into is when objects have a negative .x position (i.e. behind the camera), the rotation is opposite.

I only use X and Z for tilt and rotation.

Is there a way to calculate opposite / inverse angles so that it flips?

i.e. if x = 1.69 what should be the exact opposite?

Here's my current attempt:

        photo.rotation.x = data.rotationX != null 
            ? photo.position.x < 0 
                    ? Math.PI - data.rotationX
                    : data.rotationX
            : 0;

        photo.position.x < 0 
            ? photo.rotation.z = Math.PI
            : photo.rotation.z = 0;

        photo.rotation.y = data.rotationY != null 
                ? photo.position.x < 0 
                        ? Math.PI - data.rotationY
                        : data.rotationY
            : 0;

      

EDIT: After doing further research on this, is it possible that Three.js's way of calculating angles would be different from Away3d? those. similar problem here 3D rotation with axis and angle

It is very strange. Some of the objects are good and the same as in Away3d, and some are strange, which are nowhere close to each other.

+3


source to share





All Articles