Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: mike90136 on October 11, 2016, 10:02:53 PM
-
Hello everyone , this is my scene
(https://drive.google.com/uc?export=view&id=0B9WbX9m5OeebbXQ1dFNGbVJBRnM)
I have eight spawn points around my ship and the missile will come randomly from those spawn points.
(https://drive.google.com/uc?export=view&id=0B9WbX9m5OeebOVBLYWh5cnh6SGc)
I have eight sensors around my ship and twelve lunchers on my ship , every time a missile spawn from any spawn point , I use Find Closest to find which sensor is the closest one to the missile.
(https://drive.google.com/uc?export=view&id=0B9WbX9m5OeebX2xtTGg0NUhxc0U)
my problem is when I find out which sensor is the closest one to the missile and store it to the GameObject variable(DecoySensor).How to make lunchers fire depend on the GameObject variable(DecoySensor)??
For example when sensor 8 is the closest one to the missile so I want luncher 1 3 5 to be choose to fire.
-
Hi,
Maybe you can place your "sensor" objects into an array then after you found the closest object you can use "array contains" and store the index nr.
with that number you can use a "int switch"
or maybe you can have multiple arrays, one containing your "sensor" objects and 3 other containing the launcher's
So when you got the index number from your sensor you can use that to get the launcher's
Let say sensor 8 is on index 7 , on the 3 other array you should have launcher 1, 3 and 5 on index number 7
-
THX~djaydino
This is my result and it work just like what I want~!! ;D
(https://drive.google.com/uc?export=view&id=0B9WbX9m5OeebWTVUTkh4QVBWU0E)
-
Hi,
I am happy you got it to work :)