Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
1 registered members (TipmyPip), 18,449 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
Scanning entities #320315
04/20/10 20:58
04/20/10 20:58
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
I use c_scan function. The manual writes this:
Quote:
SCAN_ENTS scans for the object's origin only. If you have a large object, make sure the origin still lies within the scan cone.

Is there a workaround solution to catch the entity if its origin doesn't lie within the cone? The 3D GS version is 7.80.

Re: Scanning entities [Re: Aku_Aku] #320387
04/21/10 13:43
04/21/10 13:43
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You could simply increase the scan range and decide depending on their size how to go on. Or you write your own c_scan function:

you = ent_next(NULL);
while(you) {
if(vec_dist(your.x,...) < 500+your.max_x) {
just do it
}
you = ent_next(you);
}

If you need a scan cone in your own scan function, calculate the angle from the scan position to the entity and compare it to the scan direction.

Last edited by Superku; 04/21/10 13:45.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Scanning entities [Re: Superku] #320435
04/21/10 18:59
04/21/10 18:59
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Although i studied the manual, i am afraid i don't understand how works the c_scan.
For example, what does do this: mydist=c_scan(camera.x,camera.pan,vector(12,12,200),IGNORE_ME|SCAN_ENTS);
I think, based on the manual this will not detect an entity if the c_scan doesn't see the object's origin.
And if i increase the range, the situation will be the same, if the origin is not in the cone. Fix me, if the range is not the difference between the camera and the entity.
And yes, i need a cone.

Re: Scanning entities [Re: Aku_Aku] #320460
04/21/10 20:25
04/21/10 20:25
Joined: Apr 2010
Posts: 172
W
wdlmaster Offline
Member
wdlmaster  Offline
Member
W

Joined: Apr 2010
Posts: 172
c_scan can only return one entity. And the returned distance is the distance to the next entity. If no entity is in scan range, no distance is returned. If you need to scan all entities, you must use events. Look up ENABLE_DETECT and ENABLE_SCAN in the manual.

Re: Scanning entities [Re: wdlmaster] #320465
04/21/10 20:38
04/21/10 20:38
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
That is OK, the same info is in the manual.
I would like to get more help, if possible.

Re: Scanning entities [Re: Aku_Aku] #320469
04/21/10 20:56
04/21/10 20:56
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
I've already answered your question:

Quote:
You could simply increase the scan range and decide depending on their size how to go on.


For example your initial scan range is 500. You now increase this value by e.g. 500 quants. Either in the entity event function or next to the c_scan instruction you check the entity's size, for instance according to its max_x value if the entity is symmetrical.
If the returned distance is 777 and 777 < 500+entity.max_x is true, the entity touches the scan cone.
Alternatively you could write your own function with (!) scan cone as I've posted earlier.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Scanning entities [Re: Superku] #320487
04/21/10 21:48
04/21/10 21:48
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Increasing the range helps me no, if i get 0 as returned distance. So i can't use the "777 < 500+entity.max_x is true" relation.
The reason is the origin of the entity is not in the cone.
I can increase the range even 50000, result will be always 0.

Re: Scanning entities [Re: Aku_Aku] #320490
04/21/10 22:16
04/21/10 22:16
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Then how big is your entity?

EDIT: I think I understood your problem. The problem is not the distance but the scan width, right?

Last edited by Superku; 04/21/10 22:19.

"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: Scanning entities [Re: Superku] #320543
04/22/10 15:10
04/22/10 15:10
Joined: Sep 2009
Posts: 1,032
Budapest
Aku_Aku Offline OP
Serious User
Aku_Aku  Offline OP
Serious User

Joined: Sep 2009
Posts: 1,032
Budapest
Yeah the problem is the scan width. I am sorry, i wasn't enough clear.

The size of entity on the screen is cca. 7x7x7 cm, dunno in pixels...
I use the mydist=c_scan(camera.x,camera.pan,vector(12,12,200),IGNORE_ME|SCAN_ENTS); statement to detect objects.

Re: Scanning entities [Re: Aku_Aku] #320545
04/22/10 15:19
04/22/10 15:19
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
The sector/ cone is really small, why don't you just make it bigger?
For example: vector(90,90,200). If you want such a slim scan cone, c_trace would may be better IMO.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Page 1 of 2 1 2

Gamestudio download | 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