playMaker

Author Topic: [solved] Find Closest action  (Read 9360 times)

flekoun

  • Playmaker Newbie
  • *
  • Posts: 19
[solved] Find Closest action
« on: April 04, 2011, 05:49:44 AM »
Hi, I just wonder how the Find closest action works. I want to find the closest ship to a player's ship. So I tried to use this action but it always finding the player to be the closest ship (finding self). I am filtering by tag Spaceship. I suppose it should not find a owener of FSM as a closest target because then It will be always the owener of FSM who is the closest target. Am I using it wrong? Please help.
« Last Edit: April 12, 2011, 04:12:02 AM by alexchouls »

Neural Echo

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
Re: Find Closest action
« Reply #1 on: April 04, 2011, 07:32:10 AM »
Are all of the ships (including the player's ship) tagged as a 'Spaceship'?

If so, the player's ship will always be the closest GameObject to itself with the tag 'Spaceship'. You should try tagging the player's ship as 'player', and all the other ships as 'Spaceship'.

flekoun

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Find Closest action
« Reply #2 on: April 04, 2011, 11:47:20 AM »
Yes they are all tagget as spaceship. Your solution is ok, but I dont know which ship will player have. Also this should work for all ships not only players ship but CPU also. I just want to find the closest spaceship to mark where to shoot.

Edit: I found other issue. Can someone explain me why there are Get Position and Get Rotation actions but Get Scale is missing? How am I suppose to get scale of and gameobject??
« Last Edit: April 04, 2011, 11:50:01 AM by flekoun »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Find Closest action
« Reply #3 on: April 04, 2011, 01:35:59 PM »
Sounds like an oversight in the Find Closest action. It should either not return self or have that option. I'll add this...

I want to get an Updates section up this week where you can download updated actions (and other stuff) between asset store updates. It would also be a public forum to work out new actions in an open way before publishing them...

I'll also post a Get Scale action - it was just a priority issue - didn't seem as immediately useful as other actions.

I think between Action Requests and an Updates section we should be able to plug any holes in the action list and also develop some really cool actions!

flekoun

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Find Closest action
« Reply #4 on: April 04, 2011, 11:55:41 PM »
Ok I am waiting for fix as well as new Get Scale action. Take care and keep that good work going!

flekoun

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Find Closest action
« Reply #5 on: April 05, 2011, 10:43:13 AM »
I just want to make sure. There is currently no possible way how to get a scale vector of a gameobject using Playmaker. Am I right?

MaDDoX

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 165
    • FluidPlay Studios
Re: Find Closest action
« Reply #6 on: April 05, 2011, 06:04:22 PM »
I'll also post a Get Scale action - it was just a priority issue - didn't seem as immediately useful as other actions.
Please guys, don't call that a "bug" - as in something that needs a fix. You might call it an oversight, a missing action, whatever, but not a bug. After all you can do it yourself! I know people come to playmaker thinking about never looking at code again - but seriously, this is like a 2-lines copy-paste job, and Playmaker makes it ridiculously easy to test it.

And before someone says "oh yeah, then why don't you do it yourself?" - I just did. Took me 5 mins 'coz I decided to actually test if it works. It does ;) I'm pasting it in the specific section, enjoy.
« Last Edit: April 05, 2011, 06:05:53 PM by MaDDoX »
--
Breno "MaDDoX" Azevedo
@brenoazevedo

Neural Echo

  • 1.2 Beta
  • Playmaker Newbie
  • *
  • Posts: 12
Re: Find Closest action
« Reply #7 on: April 06, 2011, 06:57:23 PM »
I have modified the built-in Find Closest action to include an option to ignore the Game Object that owns the FSM that contains the action.

The code for the modified action can be found in th formum post http://hutonggames.com/playmakerforum/index.php?topic=71.0