0 registered members (),
1,295
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
C_scan
#252524
02/18/09 19:05
02/18/09 19:05
|
Joined: Jan 2009
Posts: 57 Slovakia
wolodo87
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 57
Slovakia
|
Hello, another probably stupid question (I am ashamed...) I am using c_scan but it behaves quite odd... I have empty wmb with just camera placed...no other objects. When I push some button, a globe entity is created above the position of mouse pointer...that is ok...than I create another entity same way. My c_scan function should return distance of these globes if they are close enough...but it doesn´t. Instead of this, it returns distance from x-axis if it is within range of c_scan. Here is some code... function odpud_x(var ENTpozitionX,var ENTpan)
{
var dist=0;
dist=c_scan(ENTpozitionX, ENTpan, vector(360,0,100),SCAN_ENTS);
if(you != NULL)
return dist;
} it is called in action of every new enity in a loop: sused_x=odpud_x(my.x,my.pan); What am I doing wrong?
|
|
|
Re: C_scan
[Re: wolodo87]
#252527
02/18/09 19:27
02/18/09 19:27
|
Joined: Feb 2009
Posts: 84 Deutschland/Niedersachsen
GorNaKosh
Junior Member
|
Junior Member
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
|
- Try to set the mode IGNORE_ME also and ENABLE_SCAN on each of the entities. - You scan only a 2D circle around the entity that depend on the entities pan, so the target have to be on the same layer. Maybe you should increase the second value in the vector to increase the scan area. - Then note that the scan goes to a maximum range of 100q, this could be a littel to close. Experiment with some higher values. hm, I don't konw if this make sense but to make sure that the you pointer is filled by the scan-funktion you could add this line before c_scan() hope this helps ![wink wink](/ubb7/images/graemlins/default_dark/wink.gif)
|
|
|
Re: C_scan
[Re: wolodo87]
#252592
02/19/09 06:35
02/19/09 06:35
|
Joined: Feb 2009
Posts: 84 Deutschland/Niedersachsen
GorNaKosh
Junior Member
|
Junior Member
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
|
oky, lets see var scanDist = 500;
action boid() {
set(my,ENABLE_SCAN);
pAgents[countAgents] = create_agent(me); // or what funct you have implement
var distToTarget;
VECTOR meToTarget;
while(me) {
you = NULL;
distToTarget = 0;
distToTarget = c_scan(my.x,my.pan,vector(360,360,scanDist), IGNORE_ME|SCAN_ENTS);
if(you != NULL) {
vec_set(meToTarget,mx.x);
vec_sub(meToTarget,you.x); // vector from my to you
// in this direction the agendt have to be redirect
} else {
vec_fill(meToTarget,0);
}
// move with c_move
wait(1);
}
} this snippet could be used... your problem is still that the ent don't seem to be scanned, right?
|
|
|
Re: C_scan
[Re: GorNaKosh]
#254377
03/02/09 21:24
03/02/09 21:24
|
Joined: Jan 2009
Posts: 57 Slovakia
wolodo87
OP
Junior Member
|
OP
Junior Member
Joined: Jan 2009
Posts: 57
Slovakia
|
yop, this looks and works quite fine...also not so difficult as my first solution, however i still dont know what was wrong So the script is almost complete, it needs just some tuning and debuging. Thanks again for your assistance.
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|