playMaker

Author Topic: Comparing a moving GameObject location to a static Vector3 location. [SOLVED]  (Read 2669 times)

Auris

  • Playmaker Newbie
  • *
  • Posts: 4
hello!

well, i did some searching, and i found out that i can't compare Vector3's directly.
so, my question is, what is the best way to compare Vector3's using Playmaker?

in my specific case, i have a character who makes a noise.  i store the Vector3 location of the noise, and it remains static.  then, other GameObjects who have heard the noise move towards the static Vector3 location.  what i need is to know when the GameObjects reach the static Vector3 location, so that i can tell them to do other actions.

any help is really appreciated, and i'll keep searching in the meantime.

thanks again!
« Last Edit: November 09, 2012, 02:23:38 AM by Auris »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Comparing a moving GameObject location to a static Vector3 location.
« Reply #1 on: November 09, 2012, 01:43:00 AM »
Hi,

To compare two vectors, you need to get the distance between the two vectors and check that distance. The closest to 0 the closer the two vector point are.


The move towards action is exactly what you need and with very little work you will get the result you want:
https://hutonggames.fogbugz.com/default.asp?W101

set the "finish distance" to 0.1 for example, and have an event transition that you put in "Finish Event", when the move action will be done, the "Finish event" will be trigger and you will know it's done.

bye,

 Jean

Auris

  • Playmaker Newbie
  • *
  • Posts: 4
Re: Comparing a moving GameObject location to a static Vector3 location.
« Reply #2 on: November 09, 2012, 02:21:54 AM »
Jean,

thank you so much.
one of those things that is of course so necessary that there has to be a basic command to do it.
it can be difficult searching for things, when you know what you want to do, but unsure of the "trick" to it.

thank you again,

Auris.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Hi,

 yes, so never hesitate to share doubts or questions, it's always positive.

bye,

 Jean