Hi again,

My quest to understand warping portals is not getting very far. I have
read the space warping manual section and experimented a bit. It is just
that my experimentation does not fit with my understanding from the manual.

I have two planes (which are portals) in the same sector: A and B, and i
want to make a warping portal between those two planes so that if you
enter one portal along its normal you exit the other along its normal.

Below is some example code that works ok for warping the positions but
not the orientations.

csRef<iMeshWrapper> ma = ...
csRef<iMeshWrapper> mb = ...
iPortal* pa = ...
iPortal* pb = ...
csMatrix3 abm;
csMatrix3 bam;
csVector3 abvw1 = -1 * ma->GetMovable()->GetTransform().GetOrigin();
csVector3 abvw2 = -1 * mb->GetMovable()->GetTransform().GetOrigin();
csVector3 bavw1 = abvw2;
csVector3 bavw2 = abvw1;

pa->SetWarp(abm, abvw1, abvw2);
pb->SetWarp(bam, bavw1, bavw2);

As i understand it it should be (Examples given for going from A to B):
1) Translate from current location to origin: W' = W - abvw1
2) Apply rotation matrix: W' = M * (W - abvw1)
3) Translate from origin to new location: W' = M * (W - abvw1) + abvw2

Things that seem incorrect after experimentation:

* Why do my vectors need to be multiplied by -1?

The example in the manual used +2 for the vw1 vector that was +2 in the
x direction. I figure GetOrigin() would return my location in the
various axis.


* Why if i apply a non-identity matrix (for example using csYRotMatrix3
yrot(2)) does my translation change? Shouldnt the first translation
brought it to the origin and so this application of the matrix should
only change the orientation?

I.e. Changing the rotation matrix seems to affect the the location that
i end up in NOT just the orientation that i am facing. When using a
non-identity matrix above, my translation no longer works.

Further experimentation seems to show that the rotation matrix may be
used to somehow transform vw1 before vw1 is used to translate the origin.

I know i have something worn as this is code that has been in CS for a
very long time from what i understand.


Anyhow, thanks for any help you can offer.
Brendon.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to