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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (dr_panther, Ayumi, 7th_zorro), 877 guests, and 3 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
projection matrix from front vector #381140
08/24/11 15:16
08/24/11 15:16
Joined: Dec 2000
Posts: 4,608
mk_1 Offline OP

Expert
mk_1  Offline OP

Expert

Joined: Dec 2000
Posts: 4,608
Okay, here's the problem: I have an arbitrary 3D vector based on a position and target which is my front/view vector.
I need a second vector (up vector) perpendicular to the view vector which direction is based on an orientation value -pi to pi. For orientation = 0 it shall be coplanar with the view vector pointing upwards, i.e. the orientation value depicts a rotation around of the up vector around the view vector. Any ideas how to calculate this?


Follow me on twitter
Re: projection matrix from front vector [Re: mk_1] #381146
08/24/11 15:47
08/24/11 15:47
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
I am not sure if I understand it correctly, as I somehow stopped thinking after the first sentence. But is this what you want? http://stackoverflow.com/questions/349050/calculating-a-lookat-matrix

Re: projection matrix from front vector [Re: Slin] #381149
08/24/11 16:29
08/24/11 16:29
Joined: Oct 2005
Posts: 4,771
Bay City, MI
lostclimate Offline
Expert
lostclimate  Offline
Expert

Joined: Oct 2005
Posts: 4,771
Bay City, MI
i thought you just needed the up vector at first but i stopped getting what you said once you got to the pi part. is that all you need to do is calculate the up vector?

Re: projection matrix from front vector [Re: lostclimate] #381183
08/24/11 23:11
08/24/11 23:11
Joined: Jan 2003
Posts: 4,615
Cambridge
Joey Offline
Expert
Joey  Offline
Expert

Joined: Jan 2003
Posts: 4,615
Cambridge
coplanar with the view vector pointing upwards... which plane are you talking about? what is up?

Re: projection matrix from front vector [Re: Joey] #381184
08/24/11 23:22
08/24/11 23:22
Joined: Dec 2000
Posts: 4,608
mk_1 Offline OP

Expert
mk_1  Offline OP

Expert

Joined: Dec 2000
Posts: 4,608
I was indeed not very clear on what I meant.
Basically I want to construct a lookAt-matrix BUT I don't want the up vector always pointing upwards. Here's what I want to do:

I need a matrix to project a decal so you have a projection source and a target. So far so good, I can use a normal lookAt-matrix but the point is that I want to rotate the decal on the ground, i.e. my up vector is not always (0,1,0) but should rotate around the view vector based on some orientation value. Kinda hard to explain. Maybe I can make a video tomorrow

EDIT: Coplanar meaning on one plane with the view vector so that the view and up vector span a plane (for orientation = 0 this would be the Y-axis (pointing upwards))

Last edited by mk_1; 08/24/11 23:24.

Follow me on twitter
Re: projection matrix from front vector [Re: mk_1] #381217
08/25/11 13:54
08/25/11 13:54
Joined: May 2005
Posts: 2,713
Lübeck
Slin Offline
Expert
Slin  Offline
Expert

Joined: May 2005
Posts: 2,713
Lübeck
What about:
Up (0.0, 1.0, 0.0)
Right (1.0, 0.0, 0.0)
Front (0.0, 0.0, 1.0)

And then just rotating them?
Or if you already have the front vector, it shouldnt be a problem to rotate some vector around it, problem here is just to choose one of the endless possible vectors...

Re: projection matrix from front vector [Re: Slin] #381236
08/25/11 15:33
08/25/11 15:33
Joined: Dec 2000
Posts: 4,608
mk_1 Offline OP

Expert
mk_1  Offline OP

Expert

Joined: Dec 2000
Posts: 4,608
Nvm, I got it. Part of the problem was that I didn't have any rotations. Also I had problems to construct a right vector when the up and front vector were parallel (which is somehow logical since there're endless possibilities for the right vector).

Thx all for your help


Follow me on twitter

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