Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
6 registered members (AndrewAMD, Ayumi, degenerate_762, 7th_zorro, VoroneTZ, HoopyDerFrood), 1,268 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
LucasJoshua, Baklazhan, Hanky27, firatv, wandaluciaia
19053 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
User
Trooper119  Offline 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 Offline
Expert
Xarthor  Offline
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 Offline OP
User
Trooper119  Offline 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: Trooper119] #67621
03/21/06 23:34
03/21/06 23:34
Joined: Sep 2003
Posts: 4,959
US
G
Grimber Offline
Expert
Grimber  Offline
Expert
G

Joined: Sep 2003
Posts: 4,959
US
try a c_trace

its a bit easier than cycleing though every vertex and doing a distance check

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 Offline
Expert
Xarthor  Offline
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: Xarthor] #67623
03/22/06 17:20
03/22/06 17:20
Joined: May 2005
Posts: 338
Brasil
Filipe Offline
Senior Member
Filipe  Offline
Senior Member

Joined: May 2005
Posts: 338
Brasil
i've never heard of this get_hitvertex!
i saw in the A6 SDK that there's the hitvertex variable, but the get_hitvertex flag is not defined...
does this work in the A6.31 or only in the A6.4beta?

thanks!
Filipe

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 Offline
Expert
Xarthor  Offline
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.

Re: Do you have to be in MED to identify a vertex? [Re: Xarthor] #67625
03/22/06 21:14
03/22/06 21:14
Joined: May 2005
Posts: 338
Brasil
Filipe Offline
Senior Member
Filipe  Offline
Senior Member

Joined: May 2005
Posts: 338
Brasil
strange, in the manual i have for the 6.31.4 i can't find anything about that. the page about c_trace is the same about trace.
i found it in the 6.4 manual, but in SDK the flag isn't defined.

Re: Do you have to be in MED to identify a vertex? [Re: Filipe] #67626
03/22/06 21:39
03/22/06 21:39
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Did you download the latest from the download page?
Thats the version I have and its mentioned there.

Re: Do you have to be in MED to identify a vertex? [Re: Xarthor] #67627
03/23/06 12:19
03/23/06 12:19
Joined: May 2005
Posts: 338
Brasil
Filipe Offline
Senior Member
Filipe  Offline
Senior Member

Joined: May 2005
Posts: 338
Brasil
hm, i guess i didn't download the updated manual when i got the update, then.
i'll download it now.

thanks!


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