0 registered members (),
900
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
transforming viewangle through portals
#404856
07/17/12 21:22
07/17/12 21:22
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
Good evening everybody, somehow i got really confused by angular calculation this evening(or maybe its just tooo late, maybe both) following usecase: Imagine 2 portals. from our view we look through the first and the viewangle is transformed for the outputportal. The green line marks the track the red thing is our view the blue line marks the view direction of each object How do i transform the viewangle correctly? I know it depends on the angle difference between each of these dots but somehow my output is just rubbish. Maybe someone has an idea? edit: idea, mirror the brown portals angle, substract it from the purple portals angle and add this to the view angle. Correct or incorrect? Greetings Rackscha
Last edited by Rackscha; 07/17/12 21:24.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: transforming viewangle through portals
[Re: Rackscha]
#404882
07/18/12 13:06
07/18/12 13:06
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
target portal view angle = camera.angle + (see through portal angle - target portal angle)
just a guess....
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Re: transforming viewangle through portals
[Re: Uhrwerk]
#404884
07/18/12 15:06
07/18/12 15:06
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
vec_set(PortalView.pan, camera.pan); ang_rotate(PortalView.pan, PortalAngleOffset);
This shoud work.
POTATO-MAN saves the day! - Random
|
|
|
Re: transforming viewangle through portals
[Re: Kartoffel]
#404885
07/18/12 15:11
07/18/12 15:11
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
ah thanks guys, i'll try it when i am home. so this should be my solution:
ang_diff(PortalAngOffset, PortalBrown, PortalPurple)
vec_set(PortalView.pan, camera.pan);
ang_rotate(PortalView.pan, PortalAngleOffset);
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: transforming viewangle through portals
[Re: Rackscha]
#404891
07/18/12 17:28
07/18/12 17:28
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
AH NICE, it works. My solution looks like this:
vec_set(LAng, APortal.pan);
ang_rotate(LAng, vector(180, 0, 0));
ang_diff(LAngDiff, AChild.pan, LAng);
vec_set(ATo, AFrom);
ang_add(ATo, LAngDiff);
Why the rotation by 180? as you can see in the pic above, the first portal is flipped by 180. Otherwhise, the endangle will look into the direct oposite direction. and ang_add is right here, ang_rotate at the end will result it weird angles. Just finished my vector and rotation functions which transform through portals. thanks kartoffel @Uhrwerk: your solution doesnt work, because addition/substraction is not possible for euler angles. But thanks for your effort Greetings Rackscha
Last edited by Rackscha; 07/18/12 17:29.
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: transforming viewangle through portals
[Re: Uhrwerk]
#404898
07/18/12 19:20
07/18/12 19:20
|
Joined: Dec 2008
Posts: 1,218 Germany
Rackscha
OP
Serious User
|
OP
Serious User
Joined: Dec 2008
Posts: 1,218
Germany
|
oh, thats what you mean^^ Missunderstood your example and reffered to vec_add etc
MY Website with news of my projects: (for example my current Muliplayer Bomberman, GenesisPrecompiler for LiteC and TileMaster, an easy to use Tile editor) Sparetime-Development
|
|
|
Re: transforming viewangle through portals
[Re: Rackscha]
#404900
07/18/12 20:24
07/18/12 20:24
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
ang_rotate at the end will result it weird angles. of course ._. ang_rotate rotates the euler vector relative to the current angle ...my bad anyway, nice to hear that it works!
Last edited by Kartoffel; 07/18/12 20:24.
POTATO-MAN saves the day! - Random
|
|
|
|