playMaker

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

Splankton

  • Sr. Member
  • ****
  • Posts: 258
    • View Profile
how to check for the closest position between multiple objects?
« on: October 24, 2013, 08: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
    • View Profile
Re: how to check for the closest position between multiple objects?
« Reply #1 on: October 24, 2013, 08:50:03 AM »
raycast check distance?

Splankton

  • Sr. Member
  • ****
  • Posts: 258
    • View Profile
Re: how to check for the closest position between multiple objects?
« Reply #2 on: October 24, 2013, 09:08:59 AM »
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
    • View Profile
Re: how to check for the closest position between multiple objects?
« Reply #3 on: October 24, 2013, 12:54:32 PM »
Find closest.