playMaker

Author Topic: how to check for the closest position between multiple objects?  (Read 2268 times)

Splankton

  • Sr. Member
  • ****
  • Posts: 268
how to check for the closest position between multiple objects?
« on: October 24, 2013, 11:47:37 AM »
Hi
If I have more than 2 objects that are at different positions, and the player is somewhere between, how do I get the one that it's the closest?

parallel

  • Full Member
  • ***
  • Posts: 155
Re: how to check for the closest position between multiple objects?
« Reply #1 on: October 24, 2013, 11:50:03 AM »
raycast check distance?

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: how to check for the closest position between multiple objects?
« Reply #2 on: October 24, 2013, 12:08:59 PM »
raycast check distance?

Thanks for your help, I've thought of a raycast, but the distance needs to be checked at a full 360 degrees.
Basically, it's an enemy model that comes across items to pick up. So I'm thinking it would look best if the item that is closest would be picked first. Unless a ray could still do that?  These items come and go, so I'm checking every second if an item has respawned. So if the item appears behind the enemy, I want it to check if that is closer than any other item.

mikejkelley

  • Full Member
  • ***
  • Posts: 136
Re: how to check for the closest position between multiple objects?
« Reply #3 on: October 24, 2013, 03:54:32 PM »
Find closest.