I'm creating a cube in WebGL made of mirros that have to reflect the object inside of it.

At the moment I'm stuck because I don't understand the correct logic to implement to achieve the result. I tried put a camera in every face of the cube in order to have a cubemap to apply. The problems come when I try to rotate the cube: I'm not able to make the cameras follow the rotation.

What's the correct logic to implement?

These images could give the idea of what I'm trying to do:

enter image description here

enter image description here

  • \$\begingroup\$ If the only problem you experience, is making the cameras follow the cube's rotation, have you tried creating a parent-child relationship between them, in such a way that if the give is transformed in any way, the cameras will follow? \$\endgroup\$ – TomTsagk Oct 17 '19 at 11:21
  • \$\begingroup\$ @TomTsagk yeah a sort of. I used the rotationMatrix of the cube to rotate the cameras... but after some rotations (in all axis) the result become weird. But the question is: is it correct my approach? \$\endgroup\$ – keepyourweb Oct 17 '19 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.