Data Realms Fan Forums http://45.55.195.193/ |
|
Detect things inside self (or very close) http://45.55.195.193/viewtopic.php?f=73&t=46266 |
Page 1 of 1 |
Author: | Hoovytaurus [ Mon Apr 16, 2018 1:59 am ] |
Post subject: | Detect things inside self (or very close) |
i have been looking at some mods who detect closeby things in a radius but i cannot figure out the exact code since it often has a lot of things piled on. i know you look through everything in the game currently and see which ones are close enough but what're the exact lines of code for that? |
Author: | Bad Boy [ Mon Apr 16, 2018 2:09 am ] |
Post subject: | Re: Detect things inside self (or very close) |
Something like this: Code: for actor in MovableMan.Actors do if SceneMan:ShortestDistance(self.Pos, actor.Pos, true).Magnitude < NUM_YOU_WANT then --DO STUFF HERE end end |
Author: | Hoovytaurus [ Mon Apr 16, 2018 2:14 am ] |
Post subject: | Re: Detect things inside self (or very close) |
Bad Boy wrote: Something like this: Code: bool isClose = false for actor in MovableMan.Actors do if SceneMan:ShortestDistance(self.Pos, actor.Pos, true) then --DO STUFF HERE end end doesn't shortestdistance give a vector? what would that end up giving me a pointer to? how can i also limit it to a specific radius, like 10 pixels for example? |
Author: | Bad Boy [ Mon Apr 16, 2018 3:46 am ] |
Post subject: | Re: Detect things inside self (or very close) |
Sorry, edited it a bit after I posted cause I realized I forgot some stuff. Shortest distance gives you a vector, but you can use the vector magnitudeto get you a scalar distance. To limit it to 10 pixels, you'd replace NUM_YOU_WANT with 10. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |