UnitySteer - steering library for Unity

Hello everyone,

It’s a pleasure to finally release UnitySteer, a library of steering components for Unity, covering anything from path following to obstacle avoidance to following neighboring vehicles. You can find more details, as well as the source code and a few examples, here.

The library is under the MIT license and hosted on Github, so contributions are welcome.

Cheers!

wow, i think i could really use something like this!

Just brilliant!

Ricardo, very interesting. Thank you for sharing this with the community. One question: What do you mean by “Vehicle tethering” in your features description?

EDIT: Never mind. I took a look at your project and that answered my question. Nice! :slight_smile:

Wow, not bad.

Does it handle bunching/congestion/queueing gracefully in some way?

As in… does it attempt to go another route if another entity is blocking a path, but is moving?

magwo:
UnitySteer implements pathfollowing - currently directly linking up to Path (I’m gonna do some work on this part when my vacation starts next week), so in terms of getting a path recalculated based on congestion, this is something you’d have to set up in a parallel system - tracking clumps of characters and adjusting Path connection/node weights based on that.

Great work! :smile:

It can help handle them gracefully, in the sense that it’ll do its best to ease the vehicle among the currently known neighbors, plus they can all avoid colliding with each other, but repathing is beyond the scope of the library since it doesn’t handle pathing by itself.

Like Emil points out, repathing would require your pathfinder to know that a node is more expensive because it has more objects on it, which not only depends on your pathfinder but on your specific game constraints.

Of course it can be built upon to accommodate it - you’d start on the PathFollower vehicle and the Pathway classes.

(Edited for extra details)

WOW. This is an awesome library!

Thanks for sharing :slight_smile:

Awesome … Thanks for sharing!

Glad you guys like it, do let me know if you build anything with it. :slight_smile:

Cheers,

Awesome, thanks for sharing it! :smile:

Thanks for porting the steering library. When I download the project and open it, I receive several warnings:

“Couldn’t load the script xxxxxxx becasuse it’s file name doesn’t match the class name. Please make sure the file name of the script is the same as the class defined inside it.”

Is this normal? Any thoughts how to remedy these errors and get the project working. Thanks for any help with this.

Mitch

Hello Mitch,

These are actually warnings, not errors. It’s normal, and shouldn’t stop your project from running.

I’ve seen this with standalone class files - my guess is that Unity is attempting to treat the class script the same way it treats MonoBehaviours, and when it can’t it raises the warning.

If there’s anyone from Unity reading this, can you guys elaborate?

I see - thanks for the info.

This library is awesome thank you for sharing, Any way of suppressing the warnings? Those are pretty annoying.

thank you very much on the info and files, very very useful

Not right now. They’ll go away in a future release of Unity.

I’m trying to create a pursue behavior that avoids obstacles, I’m using the WanderRadarBehavior from the obstacle avoidance example as reference, just replacing the wander part of it with a pursueBehavior.

For some reason this doesn’t work, my object pursues its target but goes over all the obstacles, I also don’t see any of the red debug lines so I can only assume I did something wrong.

Any pointers?

here’s how my class looks like

using UnityEngine;
using System.Collections;
using UnitySteer;
using UnitySteer.Vehicles;

public class PursueRadarBehavior : PursuerBehavior , IRadarReceiver{
	
	public LayerMask ObstacleLayer;
	
	// Use this for initialization
	protected void Start () {
		base.Start();
	}
	
	// Update is called once per frame
	protected void Update () {
		 base.Update();
	}
	
	public void OnRadarEnter( Collider other, Radar sender )
	{
		Obstacle obstacle;

		if( ( 1 << other.gameObject.layer  ObstacleLayer ) > 0 )
		{
			obstacle = SphericalObstacle.GetObstacle( other.gameObject );
			if( obstacle != null )
			{
				Pursuer.Obstacles.Add( obstacle );
			}
		}
	}
	
	public void OnRadarExit( Collider other, Radar sender )
	{
		Obstacle obstacle;
		
		if( ( 1 << other.gameObject.layer  ObstacleLayer ) > 0 )
		{
			obstacle = SphericalObstacle.GetObstacle( other.gameObject );
			if( obstacle != null )
			{
				Pursuer.Obstacles.Remove( obstacle );
			}
		}
	}
	
	
	
	public void OnRadarStay( Collider other, Radar sender )
	{
		
	}

}

I kinda got it working, but I had to modify MpPursuer for that purpose, I also had to add some things here and there, are we supposed to be modifying this classes or is there a better way to do all of this?