Hi,
I'm currently working at a portalsystem.
Transforming the velocity and the position of ported objects works great, but I just can't get the rotation to work.
My current system is build up of two planes portalA and portalB. If they have the same rotation their normals are looking in the opposite direction (mirrored meshs).
The code
obj.transform.rotation = portalA.transform.rotation * (obj.transform.rotation * Quaternion.Inverse(portalB.transform.rotation));
seems to work only with some portal-rotations correctly. Other arrangements of the quaternions seem to work neither. So what I need are a few univesal lines of code to correctly transform the rotation of an object from portalA to portalB like in the picture below (The object in the picture isn't rotated correctly, but it visualizes the case).
![alt text][1]
Maybe anyone of you could help me?
If you need some more information just write it. ;)
[1]: /storage/temp/60740-portals.png
↧