6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood),
1,268
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Do you have to be in MED to identify a vertex?
#67618
03/21/06 22:03
03/21/06 22:03
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
By clever programming can you: a. Do something like find the closest vertex on a model to a identified point, if so how do you do so (what vec_... command)? b. Must go into your model editor, like the title suggests, to identify what vertex you want to mess with? If you want more information to why I'm asking I can elaborate, any input would be appreciated, thanks.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Re: Do you have to be in MED to identify a vertex?
[Re: Trooper119]
#67619
03/21/06 22:36
03/21/06 22:36
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
You could use three "main" variables. one for the shortest distance, one for the number of the vertices with the shortest distance annd one for the maximum of vertics which you can get by "ent_vertices(entity)". The following code is just an idea: Code:
var dist_pos[3];
function vertex_closest(dist_pos) { var i; var shortest; var ver_pos[3]; var ver_number; //number of the closest vertex var max_vertex; i = 1; shortest = 500; //start distance max_vertex = ent_vertices(my);
while(i <= max_vertex) { vec_for_vertex(ver_pos,my,i); if(vec_dist(ver_pos,dist_pos) < shortest) { shortest = vec_dist(ver_pos,dist_pos); ver_number = i; }
wait(1); }
return(ver_number); //return the number of the closest vertex }
//Function calling: function getshot_event() { if(event_type == event_shoot) { my.hitvertex = vertex_closest(target); } }
action example_act { my.enable_shoot = on; my.event = getshot_event; }
|
|
|
Re: Do you have to be in MED to identify a vertex?
[Re: Xarthor]
#67620
03/21/06 22:48
03/21/06 22:48
|
Joined: Apr 2004
Posts: 516 USA
Trooper119
OP
User
|
OP
User
Joined: Apr 2004
Posts: 516
USA
|
Brilliant, as usuall I failed to notice the variables seated under ent_... thanks once again for the help Thunder, it was exactly what I needed to know.
A clever person solves a problem. A wise person avoids it. --Einstein
Currently Codeing: Free Lite-C
|
|
|
Re: Do you have to be in MED to identify a vertex?
[Re: Grimber]
#67622
03/22/06 14:42
03/22/06 14:42
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
@Grimber: as stated in his signature he is using A5, so c_trace won't work here. Would he be using A6, i definatly would have suggested c_trace with get_hitvertex.
EDIT: One thing about my code: I think you can remove the wait(1); at the end of the while loop, caus it becomes invalide after checking through all vertices. So it would take like 2000 frames for a model with 2000 vertices, so it would take some time till all vertices are checked. But I think there is no other solution for those who still use A5.
Last edited by Thunder; 03/22/06 15:24.
|
|
|
Re: Do you have to be in MED to identify a vertex?
[Re: Filipe]
#67624
03/22/06 18:46
03/22/06 18:46
|
Joined: Jul 2002
Posts: 4,436 Germany, Luebeck
Xarthor
Expert
|
Expert
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
|
@Filipe: Nope it's in the A6.31.4 manual about 'c_trace': Quote:
GET_HITVERTEX When called with GET_HITVERTEX and c_trace intersects an MDL that object's closest vertex number will be returned in HITVERTEX
Check the manual for further information.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|