Interested or looking for support? Ask me anything in this thread - from developer to developer
Simple Waypoint System (SWS) is an editor extension that allows you to create waypoints and paths very easily right within the editor. With those created, you can then tell any kind of game object to follow a specific path. Useful for every automated movement in your games including but not limited to:
AI Patrol behavior
Movement on a Path
Moving Platforms
Camera and Game Object animation
Cut Scenes
Simple Waypoint System provides a custom path creator interface for linear or curved splines, bezier curves and NavMesh paths. Our path creator lets you place waypoints just by clicking on ground, they get connected internally. After the part of path construction, you are still able to edit your existing path with the built-in buttons, which add or remove waypoints, place them onto other objects or invert the path direction. Movement scripts, utilizing the free tween library DOTween or Unity’s NavMesh agents, conclude what you need for a simple waypoint system.
Features:
Custom path manager editor
Linear, curved, bezier and NavMesh paths
Movement scripts with many flexible options
Call own methods at waypoints via events
Works in 2D or 3D space
Advanced example scenes
Full source code in C#
Quick Start documentation
it’s a very simple system (as stated a few times in the main post above ),
so it depends on how you setup your waypoint gameobjects. If you place them with high distance,
I am sure your path will go through hills and some uneven terrain…
Besides of that, it will work on terrain too, because you can place your waypoints onto every object.
edit: oh I forgot something, have a look at the video and the 2 screenshots, there are 2 paths with a curve, so if you place your waypoints very close to each other this could work very well for hills…
that’s definitely possible! The iMove component which moves the object has a delay variable to let the object stop at every waypoint and continue after a specified time.
Edit: delay at a specific or all waypoints is now a built-in setting.
Its an excellent product!!! Simple Waypoint System the keyword here is “Simple” and it is.
I really like this system and believe it could be the start of something bigger well Im hoping anyway.
I love that you can easily add delay of movement at any waypoint and play one animation while at that way point by simply dragging a iMove script onto the character. I can have the character randomly switch between way points by simply by selecting a different loop type from the drop down list.
Its really cool and for the price you cant beat it! I give this one 2 Thumbs Up!
I make a short faq out of recent e-mail conversations, so other users can read this, too.
Question:
I tried integrating SWS and keep getting a NullReferanceException:
NullReferenceException: Object reference not set to an instance of an object
iTween.LateUpdate () (at Assets/Plugins/iTween.cs:6453) Answer:
This could occur if you already use iTween and therefore 2 iTween scripts are located within your project.
Delete one iTween script, and (if not already done) place the other one into the Plugins folder.
Question:
I can’t assign a scene path transform to the path container slot of an enemy prefab.
How do I instantiate my enemies at runtime and have them know how to get my path? Answer:
This is a limited behaviour of Unity, scene objects can’t be assigned to prefabs.
The simplest solution would be to make a prefab per path transform (not Waypoint Manager) and assign that path prefab as path container to your enemy. Another way would be a short custom script, which returns the path transform, adds it to the Waypoint Manager dictionary, assigns it to the enemy path container and then calls iMove’s provided movement method StartMove(). Update: Version 1.2 includes an example script for runtime instantiation.
Question:
I need to replace the waypoint placement key of WaypointManager. Alt + left mouse click seems too inconvenient. Answer:
To replace the waypoint placement key, you will have to edit line 27 in WaypointEditor.cs as follows:
For example to use it without mouse input and only with key “P” pressed, replace the if query with:
“if (Event.current.type == EventType.keyDown Event.current.keyCode == KeyCode.P placing)”.
@zeek
thanks! Much appreciated
Your question via e-mail was:
“How would I make a waypoint a child of a character to instantiate at runtime? This way I can instantiate the character and the path he uses at the same time in the same place.”
If a waypoint should be the child of a character, this would not be the best solution, because this waypoint would always follow the character as it walks. Your path (and its waypoints) should never move with its walkers. The runtime instantiation part could be accomplished with a method described in the “How do I instantiate my enemies at runtime…”-answer above:
Instantiate the enemy.
Instantiate the path prefab (if needed), and set its position via script to where it should be. The first waypoint position is then equal to the path transform position.
Add this path via script to the static Waypoint Manager dictionary, like the Awake() function does in the “foreach”-part.
Assign that path transform via script to the iMove path container of your enemy.
Call iMove’s standard StartMove() method, to start movement of this enemy with the new path. Update: Version 1.2 includes an example script for runtime instantiation.
Hope this helps! I will include some changes to this workflow in the next update, to remove custom scripts and smooth it out.
I sent you early modifications to Waypoint Manager via pm.
Bought it and love it! So easy to use and perfect for moving platforms and enemies around in my game. Love it. Love it. Love it.
My one request would be a Reset function to call from script to be able to reset an iMove GameObject to a stationary position.
Example: A moving platform is triggered to StartMove() by the player. The player falls off the platform to his death and is respawned at his last checkpoint (without reloading the level). I call Reset() on the iMove platform to reset it for the player to trigger again.
Regarding your request, I tested some code and came up with this short method,
just put that into your iMove.cs script and you will be able to call it, no need to touch existing code.
public void Reset()
{
StopCoroutine("NextWaypoint"); //stops further execution, if we set a waypoint delay
iTween.Stop(gameObject); //stops movement of this gameobject
currentPoint = 0; //set current waypoint index to zero, so next time we start from the beginning
transform.position = waypoints[currentPoint]; //position our gameobject at our first waypoint
}
I will also include a more flexible solution in the next update, wrote some new features today as well.
But for the time being I hope this solves your issue. Feel free to ask more questions while dealing with SWS!
that feature would require you to edit some code, so I suggest you to wait until the next update.
I already finished runtime path instantiation support, which includes changing a path through code (this then requires 2-3 lines).
The new version with another great feature (can’t say more) will be released in early february, I hope you can wait until then!
You can place your paths / waypoints wherever you want, so they could cross or intersect each other.
However, two paths cannot share the same waypoints - they are independent.
Not yet. But since every walker / AI object moves from waypoint to waypoint, this could be fairly easy to implement. Before calling the automatic movement function (which brings the walker to the next waypoint), all you need to do is integrate your own function that checks if other walkers are in closer range and therefore delay the movement. The functionality of iTween also allows to check that every frame, while between waypoints, with it’s “onupdate” parameter.
Your objects automatically walk through each other, if they don’t have a rigidbody and thus physics disabled.
I decided to not hold back the next update and it’s live on the Asset Store out now!
The big new feature is runtime instantiation,
this comes along with changing paths at runtime and better control of your walker objects.
Theres also a new example script for this purpose.
Full Changelog:
Fixes&Changes
-replaced some calculations with iTween’s internal methods
-iMove now has direct access to Path Manager waypoints
(your walker objects will update at runtime when you reposition waypoints)
-reset delay at specific waypoints if path container gets null fix
Features:
-WaypointManager: AddPath() added to support more flexibility and path instantiation
-iMove: added SetPath(), Stop() and Reset() methods, see documentation
-Example_Runtime: new script to demonstrate combinations of those new methods