generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Find nearest part.

Previous Thread :: Next Thread 
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 08:07 AM
Hi, can anyone help me with a script that find's the nearest part in a radius of 100 studs?


~Andreas98~
Report Abuse
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 09:23 AM
Bump?
Report Abuse
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 09:47 AM
Bump again..
Report Abuse
rangersmash is not online. rangersmash
Joined: 18 Nov 2009
Total Posts: 2891
26 Feb 2012 09:48 AM
[ Content Deleted ]
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 09:50 AM
Use region3

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
26 Feb 2012 09:55 AM
@nate890

region3 can be efficient but it may give different result..
'.'=find
'[]'=wont find


i.e:
region3 radius
[B].....
.........
......[A]
magnitude radius
[][][][.
[][......
[].......
......[A]
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 09:57 AM
That was a horrible diagram. Using magnitude, you'd need to use recursion.

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
26 Feb 2012 10:03 AM
I know that's horrible.. but I can't make better one which is text-based :P
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 10:07 AM
Region3:
x x x x x
x x x x x
x x + x x
x x x x x
x x x x x
Magnitude:
o o x o o
o x x x o
x x + x x
o x x x o
o o x o o

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
noobkid is not online. noobkid
Joined: 17 Sep 2007
Total Posts: 649
26 Feb 2012 10:13 AM
My one was just one quarter of the coordinates
Report Abuse
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 11:38 AM
I'am not so good to use region3 yet.. Can anyone maybe post a script? :)
Report Abuse
UFAIL2 is not online. UFAIL2
Joined: 14 Aug 2010
Total Posts: 6905
26 Feb 2012 11:39 AM
Don't use Regoin3, use .magnitude.

~When life gives you lemons, you say 'I ain't even mad'.~
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 11:42 AM
People don't know what Region3 is so they suggest the thing they do know; making your outcome bias,

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
stravant is not online. stravant
Forum Moderator
Joined: 22 Oct 2007
Total Posts: 2893
26 Feb 2012 11:43 AM
Well, even if you used a region3 to get a rough list of the parts to use magnitude checks on it wouldn't work because FindPartsInRegion3 returns at most only a small number of parts, and there would probably be more parts than that in the 100 stud radius, so it would have a good chance of missing the true nearest part some of the time.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 11:45 AM
Oh, read 100 as 10. Berr.

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 12:00 PM
Okay.. So could anyone make/find a script that find's the nearest part? I don't really see the difference from region3 and magnitude :)
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
26 Feb 2012 12:03 PM
I'll make a reference list for you;

Region3:
http://wiki.roblox.com/index.php/Region3
Put to use:
http://wiki.roblox.com/index.php/FindPartsInRegion3
http://wiki.roblox.com/index.php/FindPartsInRegion3WithIgnoreList_(Method)
Magnitude:
http://wiki.roblox.com/index.php/Magnitude
Recursion:
http://wiki.roblox.com/index.php/Recursion

"Bro five! Wear this to let everyone know you think they deserve a high five."
Report Abuse
andreas98 is not online. andreas98
Joined: 10 Sep 2008
Total Posts: 246
26 Feb 2012 01:43 PM
I made my own perfectly working script now :D Thanks for posting though.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image