Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Find In Radius?

Author
Message
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 23rd Jun 2009 05:06 Edited at: 23rd Jun 2009 05:07
Is there some sort of gdk command that would let you specify a certian x, y, z point along with a radius and it would check that radius from the point to see which models are in it?

like find models in radius of 256 from point 52,45,96?

EDIT: if not I could figure out how to do it on my own with a for loop, but if gdk had a command it would make things a lot easier.

AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 23rd Jun 2009 05:10
Do you want to know if a model is actually in the radius, or if any part of the model is within the radius?

If it's the former, then you can just loop through each object and compare its distance to the point with the radius. If it's the latter, then you can create a sphere with the specified radius and position it at the specified point, then call Object Collision() with the sphere and each object you're checking, and if it returns a 1 then part of the object is in the radius.

i like orange
kklouzal
15
Years of Service
User Offline
Joined: 15th May 2009
Location: Arizona
Posted: 23rd Jun 2009 06:28
Oh thank you very much! =D

IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 23rd Jun 2009 15:59
You don't need to create an object to check for sphere collision (which is what you are doing really).

Instead, calculate the distance between each sphere, subtract both of their radii, and if the result is less than zero, they are overlapping.

You can get the object's radius by using the dbGetObjectSize function IIRC.

Login to post a reply

Server time is: 2024-10-01 06:04:17
Your offset time is: 2024-10-01 06:04:17