playMaker

Author Topic: Wait for character controller to reach position? [SOLVED]  (Read 2244 times)

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Wait for character controller to reach position? [SOLVED]
« on: March 03, 2014, 04:10:40 PM »
Sorry if this is a really simple question, but I am writing a custom action where I have a list of vectors and I want to go from point to point. So there is 1 action which basically gets the next vector in line and outputs the vector, then the next action uses the character controller to move to the vector.

The problem I have is that the move action does not seem to finish, and I do not know (without writing a custom action to compare the 2 positions to see) if I have reached the destination.

As I assume this is a common sort of thing I was just wondering if someone could point me in the simplest way to do this?

I basically want to keep flicking between the 2 states until the entity either reaches the end of the list or another state kicks in to stop it following the path.
« Last Edit: March 05, 2014, 03:31:15 AM by Grofit »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Wait for character controller to reach position?
« Reply #1 on: March 04, 2014, 03:15:03 AM »
Hi,

 Have you considered using ArrayMaker for this? seems like it has everything you need already?

your problem could be that your custom action doesn't call "finish", or that it's stuck in its own logic. when I have this kind of problem, I use a lot of debugs in the console to know exactly what happens. I also implement delays in each state and then I can stufy each variables and their values.

bye,

 Jean

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: Wait for character controller to reach position?
« Reply #2 on: March 04, 2014, 03:30:40 AM »
I dont think the storage mechanism of the vectors is really that important, be it a list/array. The crux of my issue is the fact that when I want to use one of the vectors and move the character controller to that point I don't know when the character controller has reached the point as it never fires a finished event.

So to make the question more succinct:

The Character Controller Move or Simple Move actions do not have any callback or way to tell you that it has reached the destination, so is there some best practice way of knowing if it has reached its destination?

(If there is not a best practice way I am happy enough to write my own actions based upon the existing source code for the move action, and just every frame check if it is close enough to the destination.)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Wait for character controller to reach position?
« Reply #3 on: March 04, 2014, 06:37:46 AM »
Hi,

 ah ok, I see now.

 simply get the position of your player, and get the distance between this player position and your current target. If it's less then a certain value, you can assume it's close enough to target the next position in the list.

does that make sense? or is this process ok, but you don't know how to realize it in playmaker?

Bye,

 Jean

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: Wait for character controller to reach position?
« Reply #4 on: March 04, 2014, 03:20:11 PM »
Yeah it is more solving the problem in the playmaker world, as I was expecting there to be a vector3 test action or something but there is not. Anyway it seems there is no pre-made way to do this so will just make a vector3 distance check or something.

Thanks for taking the time to respond though, I will have lots of questions over the coming months :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Wait for character controller to reach position? [SOLVED]
« Reply #5 on: March 06, 2014, 07:57:53 AM »
hi,

 actually there is a vector3 compare custom action:

http://hutonggames.com/playmakerforum/index.php?topic=3058.msg13988#msg13988

bye,

 Jean