Is it possible to mirror an object by specifying its rotation in a special way? Can I do so using quaternions somehow?
Thanks.
A fast, easy to use, free, and community supported 2D game engine
Is it possible to mirror an object by specifying its rotation in a special way? Can I do so using quaternions somehow?
Thanks.
I don't think a 3d rotation can give you a truly mirrored object. For that I believe you would need a 4 dimensional rotation.
Or you can just scale the object by -1 on the axis normal to your desired reflection. I believe this will also turn the object inside out, in which case you'd need to cull front faces instead of back faces.
There may well also be a solution using quaternions. I know approximately nothing about those.
Scaling by -1 is a good idea, smart you.. I got this working by checking whether the determinant of the rotational part of the affine transform matrix is negative, then I negate the x value of the scale, and this reflects the mesh along the x axis and also causes the inside of the triangles to be rendered instead. Then, I just set the CC3Node's property shouldCullBackFaces to NO and shouldCullFrontFaces to YES (introduced in cocos3d 0.5.4). It works great now.
Thanks.
You must log in to post.