playMaker

Author Topic: Generate path to follow with Mouse Pick[SOLVED]  (Read 8487 times)

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Generate path to follow with Mouse Pick[SOLVED]
« on: August 07, 2013, 08:09:12 AM »
Basically I was using the Mouse Pick to get my character to move to a position.

I am definitely in the beginner stage regarding game making, but using a Mouse Pick to get the position was easy enough. The problem is that I need be able to create several new points afterwards, and have the character go through all of them. I guess I am asking how I continuously store these new points so they make a path?
« Last Edit: August 16, 2013, 12:57:27 PM by Derphouse »

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #1 on: August 07, 2013, 05:51:52 PM »
Is it really that complicated? :/

sebaslive

  • Hero Member
  • *****
  • Posts: 572
    • Frame Tale Studios
Re: Generate path to follow with Mouse Pick
« Reply #2 on: August 07, 2013, 06:04:54 PM »
Not entirely sure what you mean but I assume you want to store the position of each point that is clicked so that it follows those points one by one?

I would suggest arraymaker. Check out the samples that are included in the package that would help out. https://hutonggames.fogbugz.com/default.asp?W715

Another way I suppose would be to create an empty game object that places the move to position and have a difference action from player position to empty gameobject position so it always goes to the closest empty game object but the arraymaker would organize it much better and have them numbered as a path.

Lane also has an action up called clickmove.unityPackage that you can check out.

http://hutonggames.com/playmakerforum/index.php?topic=3122.msg14297#msg14297
« Last Edit: August 07, 2013, 06:10:00 PM by sebaslive »
All my VR games use Steam VR Playmaker Toolkit: http://u3d.as/u20
And Oculus Touch Playmaker Toolkit: http://u3d.as/QT5


Follow me @sebasRez

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #3 on: August 07, 2013, 06:27:41 PM »
I will try out ArrayMaker and see what happens.

Thanks for the help. :)

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #4 on: August 10, 2013, 06:29:34 AM »
Tbh. my "trying it out" seems to be overqualifying myself.

I might need some help on the ArrayMaker solution. As to how do I specifically store several points etc. I am really not experienced here.

My closest attempt was to continuously switch from one state to another as you click to make a point for the path. This way it would jump between two on-going points. The problem, however, you can easily place 3 or in theory, 10 points, before the player reaches the first.

So I guess ArrayMaker is the way to go, but I could really use any help on the matter.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Generate path to follow with Mouse Pick
« Reply #5 on: August 10, 2013, 07:16:20 AM »
What functionality are you after exactly.

If the player clicks, it creates a point to move to, if the player clicks again and the player hasn't reached the first, it adds it as a second way point IF it isn't closer then the first? and also a set max distance from the first point.

That's just an example of what you might be after ... but would be helpful to hear exactly with all the possible outcomes what you want.

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #6 on: August 10, 2013, 07:30:49 AM »
Sorry, I tend to forget the clear picture of what I want is restricted to my mind, lol.


Well, basically you're suppose to create a path. And clicking on the surface creates a waypoint. Nothing will interfere the player from going to this waypoint. So you basically create a path that is restricted to go through ALL waypoints. Which means I need to store the position of all the waypoints made, and make sure the player doesn't skip, or ignores any of them, etc.

I hope this makes more sense.

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Generate path to follow with Mouse Pick
« Reply #7 on: August 10, 2013, 08:49:28 AM »
Makes perfect sense!

Array maker is what you will need so you're on the right track.

Click one position is stores in an array of vector 3's (I assume you can use array maker - if not I can write a step by step for ya)
Player walks to that point using a separate FSM
Check the distance to this point everyframe (or some form of checking if the player has reached the point. If the player hasn't reached this point add the second click as a second vector3 to the array.
When the player gets to a point, remove it from the array and get the next position (if there is one) and move to that. this sequence will end when there are no more vector3 variables in the array.

Hope you understand ... if not just tell me and ill write it .... when it's not 2am :P
« Last Edit: August 10, 2013, 08:51:24 AM by LampRabbit »

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #8 on: August 10, 2013, 09:02:14 AM »
Haha, I appreciate the help..

but yes, I do think my problem persists in not completely understanding ArrayMaker, even though it sounds like it makes sense, I'd much appreciate a step by step if you get the time for it!

Thanks in advance! :)

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Generate path to follow with Mouse Pick
« Reply #9 on: August 10, 2013, 08:19:54 PM »
Ok, ill make some screen grabs .. will be easier


Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #10 on: August 11, 2013, 02:17:47 PM »
Sounds awesome! :)

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Generate path to follow with Mouse Pick
« Reply #11 on: August 15, 2013, 08:44:35 AM »
Here ya go, better than screens, hope it helps :D Any questions just ask.

Derphouse

  • Playmaker Newbie
  • *
  • Posts: 17
Re: Generate path to follow with Mouse Pick
« Reply #12 on: August 15, 2013, 09:01:17 AM »
It looks great, I'm getting an error that I don't understand, considering both the type and the variable is vector3

"The fsmVar value <UnityEngine.Vector3> doesn't match the value <System.Single>"

EDIT: Works very nice! It seems it was just set to float instead of v3 in the input for the array list.
« Last Edit: August 15, 2013, 11:42:45 AM by Derphouse »

escpodgames

  • Hero Member
  • *****
  • Posts: 687
    • Assets
Re: Generate path to follow with Mouse Pick
« Reply #13 on: August 15, 2013, 05:29:02 PM »
Hmmm weird, it's a vector3 on mine and I tested it on both my mac and pc ... oh well ;P

Is that what you were after?

gegagome

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Generate path to follow with Mouse Pick
« Reply #14 on: August 15, 2013, 05:41:46 PM »
I think you need a plugin called::: Spark Plug Tools Path Drawing System
https://www.assetstore.unity3d.com/#/content/5619
I am testing it in my app, and it is great!

Haven't implemented it in PlayMaker but I'm here to learn more