PlayMaker Help & Tips > PlayMaker Help

Comparing a moving GameObject location to a static Vector3 location. [SOLVED]

(1/1)

Auris:
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!

jeanfabre:
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:
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:
Hi,

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

bye,

 Jean

Navigation

[0] Message Index

Go to full version