playMaker

Author Topic: [SOLVED] Waypoint Intersection DoTween  (Read 1378 times)

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
[SOLVED] Waypoint Intersection DoTween
« on: March 29, 2020, 09:52:10 AM »
Hello,

Im using DoTween for my waypoint system to move the player around (with arrow keys for now). What Im unsure of is how to transition at an intersection and was hoping someone had some perspective on the best way to handle something like this, if there were many intersections and decisions.

Its easy to go through waypoints that are in order such as 1,2,3 and then end at the end point but Im not sure of the best way to handle multiple intersections of waypoints (please see attached image). My scene will probably have somewhere around 250 waypoints which is a lot of FSM states.

I just had a thought maybe have a trigger at each intersection then wait for player input (left, right, up, down) to decide which one to goto next.
Trying to think about how to string these things together hurts my brain lol

If anyone has any better ideas I would love to hear them.
« Last Edit: March 29, 2020, 04:15:42 PM by Kodagames »
Have I said how much I love playmaker!!! This is one amazing tool

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: Waypoint Intersection DoTween
« Reply #1 on: March 29, 2020, 12:19:56 PM »
Ok, on the theory of using a trigger at each intersection to make it more modular (and easier), I have decided not to use a path system and just use the DoTween Transform Local Move which seems to work quite nice (see attached image, only 2 inputs it will have 4).

The final question:
How would I check if an input (direction) is available? In some circumstances there may only be 3 directions to move in instead of 4. Im thinking Id have to do a bool check (which I would set (in the inspector)) if a direction is not available.

How to do it I have no idea lol Yay more testing :D
Have I said how much I love playmaker!!! This is one amazing tool

LuminRabbit

  • Full Member
  • ***
  • Posts: 161
  • Lumin Rabbit
Re: [SOLVED] Waypoint Intersection DoTween
« Reply #2 on: March 29, 2020, 04:15:01 PM »
Alright, Solved :D

I created a trigger (which can be the prefab for all points I need the player to transition or move to), I simply need to duplicate one for reach point in the game where I want it to go.

Once triggered by the player it goes to state "Wait for input" which has 4 Get Key Down actions, when a key is pressed there is a checker for each key "Checker left, right etc..". Inside the checker is a simple Bool Test action (which is set in the inspector), if true run the DoTween action for movement, if false return and wait for input (nothing will happen if false). Once the DoTween has finished moving the player it will return and go through a DoTween Clear Cache Action (kind of like clearing out your browser), then goes back and waits for another trigger event.

I've tested and it seems to work pretty good so far, I like that its kind of modular, when once in the scene I can do everything from the inspector checking which directions are available as well as adding the Transform to that direction.

Im sure there's probably a better way (if there is please let the community know), as of now Im pretty happy with the results ;). I hope to be able to showcase the game on here soon.

Mike
Have I said how much I love playmaker!!! This is one amazing tool