playMaker

Author Topic: Find Closest if on same axes  (Read 733 times)

Empire

  • Playmaker Newbie
  • *
  • Posts: 10
Find Closest if on same axes
« on: November 02, 2021, 09:52:41 AM »
Hi, can anyone please help me convert the "Find Closest" action to add find closest tag on the same X axes as owner? The action already lets me find by tag but I can't figure out how to confine it to "X" axes.

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: Find Closest if on same axes
« Reply #1 on: November 02, 2021, 12:33:31 PM »
Seems like a simple way would be get prefab X axis save it. get closest check if value matches if not move to next?

Empire

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Find Closest if on same axes
« Reply #2 on: November 02, 2021, 12:44:05 PM »
Seems like a simple way would be get prefab X axis save it. get closest check if value matches if not move to next?

Hmm... I think I get where you're going but I'm struggling with the "if not move to next part" more specifically identifying the next object.

Captaincrud

  • Junior Playmaker
  • **
  • Posts: 72
Re: Find Closest if on same axes
« Reply #3 on: November 02, 2021, 02:09:18 PM »
maybe make a array add it to the array change its tag when action done take all items from array change tags back?

Empire

  • Playmaker Newbie
  • *
  • Posts: 10
Re: Find Closest if on same axes
« Reply #4 on: November 02, 2021, 02:30:56 PM »
maybe make a array add it to the array change its tag when action done take all items from array change tags back?

Thanks, I looked at array but then realized since I'm looking at 1 axes I think an easier way is to just use a raycast.

Update: I just added
Code: [Select]
if (go.transform.position.z != obj.transform.position.z)
{
continue;
}

in the foreach section of the FindClosest code.
« Last Edit: November 07, 2021, 11:36:32 AM by Empire »