Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (M_D), 1,430 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
normal to closest axis direction #456921
12/15/15 19:03
12/15/15 19:03
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline OP
User
Wjbender  Offline OP
User
W

Joined: Mar 2012
Posts: 927
cyberspace
given that I have a normal that is not facing true to any axis , how can I change it to face in the direction of the axis closest to it ?

I want to let a normal face directly upward if the normal is closest to the upwards axis , and I want it to face directly left or right or forward or backwards if it closer to one of those direction , how would I do such ?

or I guess the question could be thrased as , how to determine in which direction a normal faces ?

Last edited by Wjbender; 12/15/15 19:09.

Compulsive compiler
Re: normal to closest axis direction [Re: Wjbender] #456922
12/15/15 19:11
12/15/15 19:11
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I can think of two ideas right know:
1) You compare the absolute values of the normal and choose the direction then.
2) You use vec_dot with the 3 default directions and take the direction which results in the biggest dot product.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: normal to closest axis direction [Re: Superku] #456923
12/15/15 19:51
12/15/15 19:51
Joined: Mar 2012
Posts: 927
cyberspace
W
Wjbender Offline OP
User
Wjbender  Offline OP
User
W

Joined: Mar 2012
Posts: 927
cyberspace
thanks superku , I will try it , currently I have a rather expensive way of trying to do it .

I had the triangle vertices of a face , and I aligned them planar , then I calculated the face normal for the planar triangle and used the resulting normalized normal to determine direction , but at a larger cost .


Compulsive compiler

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