1 registered members (AndrewAMD),
807
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Touching direction
#408560
10/03/12 18:41
10/03/12 18:41
|
Joined: Aug 2011
Posts: 58 Colombia/Bogotá
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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
Expert
|
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-...
gameplan
Member
|
Member
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á
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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
Expert
|
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á
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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
Expert
|
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á
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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
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á
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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á
wdakfenixx
OP
Junior Member
|
OP
Junior Member
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
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|