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
1 registered members (AndrewAMD), 946 guests, and 5 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
Touching direction #408560
10/03/12 18:41
10/03/12 18:41
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
Im trying to make a cube that executes different functions according with the face I´ve clicked, I just don´t know how to define wich one I´ve clicked, Any ideas?


CAUTION :The content above could blow your mind
Re: Touching direction [Re: wdakfenixx] #408562
10/03/12 18:52
10/03/12 18:52
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Calculate the difference vector between the clicked position and the cubes center. Then you can examine which of the three components got the greatest absolute value and its sign.


Always learn from history, to be sure you make the same mistakes again...
Re: Touching direction [Re: Uhrwerk] #408565
10/03/12 19:20
10/03/12 19:20
Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
G
gameplan Offline
Member
gameplan  Offline
Member
G

Joined: Aug 2011
Posts: 133
Germany, Supergeheimes Hinter-...
Or try to use this to get a vector normal to the specific cube face:

vec_set(to,mouse_dir3d);
vec_scale(to,2000);
vec_add(to,mouse_pos3d);
c_trace(mouse_pos3d,to,USE_BOX | IGNORE_SPRITES | IGNORE_FLAG2);
vec_set(to,target.x);
vec_set(vec_normal,normal);

As Uhrwerk said, you can examine the greatest value with the normalvector from this code.

Last edited by gameplan; 10/03/12 19:23.

Version: A8 free
OS: Windows 10
Re: Touching direction [Re: gameplan] #408570
10/03/12 20:28
10/03/12 20:28
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
Uhrwerk: I get you, that was i tried to do, but i dont know how to especify the position i've clicked, if i use c_trace it returns the cube center
gameplan:thanks, but i'm not sure if i used that script correctly, but the result depends on my position and i need to be able to click any face from any position i.e. from some positions you can see tree faces of a cube and if im in that position i need to be able to click any of these faces


CAUTION :The content above could blow your mind
Re: Touching direction [Re: wdakfenixx] #408575
10/03/12 20:49
10/03/12 20:49
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
c_trace should return the distance to the hit entity, not a vector. Or were you talking about the hit vector?


Always learn from history, to be sure you make the same mistakes again...
Re: Touching direction [Re: Uhrwerk] #408576
10/03/12 20:50
10/03/12 20:50
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
yes i was talking of the hit vector

Last edited by wdakfenixx; 10/03/12 20:56.

CAUTION :The content above could blow your mind
Re: Touching direction [Re: wdakfenixx] #408579
10/03/12 21:03
10/03/12 21:03
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Now that is strange. Have you set USE_POLYGON? Did you try to create a particle at the hit vector's position in order to actually see where it is?


Always learn from history, to be sure you make the same mistakes again...
Re: Touching direction [Re: Uhrwerk] #408583
10/03/12 21:41
10/03/12 21:41
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
i had it dislabed before but even when it is, it place a sphere that i use as a mark weirdly, no matter where i click it place the sphere in the direction im looking each time closer to me
Code:
c_trace(camera.x,vec_rotate(vector(90000,0,0),camera.pan),USE_POLYGON|SCAN_TEXTURE);
	ent_create(SPHERE_MDL,hit.x,NULL);


Last edited by wdakfenixx; 10/03/12 21:42.

CAUTION :The content above could blow your mind
Re: Touching direction [Re: wdakfenixx] #408584
10/03/12 21:47
10/03/12 21:47
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
Ahhh now i get it, its because its going to put it at the "end" of the trace, i´ve solved it now


CAUTION :The content above could blow your mind
Re: Touching direction [Re: wdakfenixx] #408585
10/03/12 22:09
10/03/12 22:09
Joined: Aug 2011
Posts: 58
Colombia/Bogotá
W
wdakfenixx Offline OP
Junior Member
wdakfenixx  Offline OP
Junior Member
W

Joined: Aug 2011
Posts: 58
Colombia/Bogotá
Ahhh now i get it, its because its going to put it at the "end" of the trace, i´ve solved it now


CAUTION :The content above could blow your mind

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