Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 900 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
transforming viewangle through portals #404856
07/17/12 21:22
07/17/12 21:22
Joined: Dec 2008
Posts: 1,218
Germany
Rackscha Offline OP
Serious User
Rackscha  Offline 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 Offline
Expert
Uhrwerk  Offline
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 Offline
Expert
Kartoffel  Offline
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 Offline OP
Serious User
Rackscha  Offline 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:
Code:
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 Offline OP
Serious User
Rackscha  Offline OP
Serious User

Joined: Dec 2008
Posts: 1,218
Germany
AH NICE, it works. My solution looks like this:

Code:
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 laugh

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: Rackscha] #404895
07/18/12 19:01
07/18/12 19:01
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
You're even using ang_add and ang_diff in your code... confused


Always learn from history, to be sure you make the same mistakes again...
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 Offline OP
Serious User
Rackscha  Offline 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 Offline
Expert
Kartoffel  Offline
Expert

Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
Quote:
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 smirk

anyway, nice to hear that it works! smile

Last edited by Kartoffel; 07/18/12 20:24.

POTATO-MAN saves the day! - Random

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1