UnitySteer 2.2 released
Update: Want to see UnitySteer in action? We’re using it for our own game, click here for a preview.
Most of my UnitySteer work lately has been on the experimental branch, where I’ve pretty much completely replaced neighbor and obstacle avoidance with the velocity obstacle implementation I mentioned a few posts back. While I still have to extract that implementation from the game, I also had quite a few changes on the development branch that I hadn’t formally released, including several bugfixes, so I’ve decided to release UnitySteer 2.2 to hasten the process.
Barring any intermediate bugfixes, this is going to be the last release to use the old neighbor avoidance code, and the next one will move into using the RVO approach.
Here is the changelog:
- Added DetectableObject as a Vehicle base class. This will allow us to make some static targets in scenes approachable with the same routines as we would approach a vehicle, without the need to have the Vehicle overhead.
- Removed outdated AngryAntPathway. This was meant to be used with Path 1, which does not work with Unity 3. For a draft Path 2 seeker, see this gist.
- Allowing ‘speed’ and ‘forward’ override on to Vehicle.ComputeNearestApproachPositions. This override, as well as the previous one, will allow us to use this method to estimate the likelihood of crashing into a vehicle at a future orientation and speed, which are not necessarily the same as the ones that our current vehicle has. This is something I am using on my RVO implementation.
- SphericalObstacleData now expressed in terms of DetectableObject.
- VehicleEditor now relies on DetectableObjectEditor.
- SteerForPathSimplified bugfix. There was an issue when the character’s path began on its position (ie, the character was already on the path) but the character’s speed was 0. In this case, the future path position estimated was the same as the current position, which caused the steering behavior to believe it had already arrived.
- SteerForPathSimplified bugfix. On very slow agents with a twisting path and a close prediction time, it’s possible that the future predicted point will still be within the vehicle’s radius, which caused it to believe it had arrived.
- Setting cached transform on Position getter if necessary.
- Radar will now disregard disabled vehicles by default. You can change this behavior by setting its DetectDisabledVehicles property to true.
- Added property SteerForPathSimplified.MinSpeedToConsider for configuring the minimum estimation speed.
- Increased default steering weight. The previous default weight of 1 could be too low in some cases.
- Increased default prediction time on SteerForPathSimplified. The default value might have been too low for the default vehicle speed of 1, so I’ve increased it to allow people who are just starting to build up their own examples to get a better feel for the reaction.
- Steering.ReportedArrival defaults to true on Start() to avoid unnecessary arrival notifications.
- SteerForNeighbors is now an abstract class, to avoid confusion for users. Some people were trying to use it directly, instead of using the classes that implement it.
There are other improvements I wanted to include, but they’re somewhat tangled in the experimental changes, so they’ll have to wait until the experimental branch is ready for mass consumption.
You can find the source on Github, or download the updated examples project.










Wow very cool. I’m using 2.1 with neighbor and obstacle avoidance. I started using UnitySteer a few weeks ago. I guess I should start learning the RVO Approach but I really know what that is.
I have a question. In my testing of 2.1 I had used some cylinders with the layer marked as Obstacles. Is SphericalObstacleData also needed or is that something to use to make the collision radius more adjustable?
Also I’m trying something where I have a vehicle wander around for food. When it get close enough I switch the behavior to pursuit. This works ok but their are times when the food is just to the side of the vehicle and the vehicle stops without turning to the direction of the food. Ideally I’d like to make the vehicles head spin and touch the food but no matter what Radius/Arrival Radius I use there is always a pause or stop in movement. Will 2.2 fix this problem? I had tried moving the vehicles center to be more at the front/head but I noticed that this locks to Unity’s global axis and not to the local axis of the vehicle. So rotations of the center do not follow.
RVO – correction I don’t know what that is…
Hello Tom,
No need. It can be treated as just another component that combines neighbor avoidance and obstacle avoidance, while significantly improving the neighbor avoidance behavior, even if there are some cases in which it’ll work better (I wouldn’t use this implementation for a car, for example).
The latter. The basic approach creates an obstacle based on the object’s collider bounds, but SphericalObstacleData allows you to override that.
I am not aware of any bugs with the pursuit behavior.
I’m afraid I cannot really say what might be going on without at least looking at some video of the vehicle’s inspector in debug mode, to see the set up and how much force each component is contributing.
If by any chance you’re *adding* a new SteerForPursuit behavior instead of enabling an existing one, that won’t work, as AutonomousVehicle caches a list of the existing Steering behaviors on start.
Hello,
I would use for A.I. UnitySteer an animal but not how. I built a wild animal with Unity for horse simulation. I created an animation (run, walk, jump, etc) with using locomotion. First, I need to know how I can detect the speed from autonomous vehicle class or maybe another class what I need, because I want to create health and stamina based on by walking, running, etc. If the horse move by autonomous vehicle, then it will decrease health and stamina. And if idle, the horse can regain stamina.
Can you give me some advice on how to implement this?
I am sorry, I am new in game development.
Thank you in advance.
regard,
Mania
Hello,
What you’re looking for is Vehicle’s Speed property. You may also want to look at Velocity, which tells you not only the speed at which they’re moving but their direction vector.
Cheers,
Ricardo
Thanks Ricardo for your reply and advice. The problem about speed was solved. Now I have a problem about state machine using unity steer. I’m using steer for target for move my horse to the some place, but after my horse (autonomous agent) arrived to the place I’m still confuse how to implement for moving as next destination or use steer for other behavior. Can you give me some advice how to implement this?
Thanks
You would assign a new point.
Alternatively, you could use SteerForPathSimplified, as described here: http://www.arges-systems.com/articles/213/unitysteer-upcoming-path-following-changes/
Hello,
This might be a silly question. I’ve just started looking into unitySteer. I’m trying to adapt the behaviors for use with some physics-based cars that I’ve already created.
In looking at the SteerForPursuit.cs behavior, I’ve found that it returns “force”, which is a vector. I’m assuming this vector contains both the direction and force that must be applied to the vehicle for the steering behavior to work. Is this correct?
Thanks.
Hello Juan,
Yes, the Force vector combines a direction and a speed. You can see it as units per second in the direction that the vector points at.
Cheers!
Hi!
I’m using unitysteer to move players in a sports game, it’s working fine, thanks.
When players are defending they need to recover then ball by crashing with other team’s members, and when attacking they need to avoid collisions to keep the ball.
When some player is going to crash an adversary, it stops just before collision and colliders don’t trigger the event, how can I do to make some player to seek for contact and others to avoid it.
I’ve tried to disable the obstacle avoidance behaviors, also setting arrival radius and detection radius (from radarping) to 0, but doesn’t seem to work. Players keep stopping before collision.
Any advice?
Thanks
Hello Gilberto,
To make some players seek contact in one state and at others avoid it, you may want to look into behavior trees. AngryAnt’s Behave is my tool of choice, but there are others available.
I am not sure what can be causing the players to stop, as from what you describe it is not UnitySteer-related. This might be a bit obvious, but have you checked that it is not the collider itself stopping them from getting within a certain distance of each other?
Hi,
I am working on the AI of a car racing game.
I want to implement Steer TO Follow Path in my code but I do not know how to feed a path to the script.
I have simple behavior working in the project i.e. Seek, but i am unable to figure out the input of Steer To Follow Path.
I have added two scripts to the car 1. Autonomous Vehicle, 2. Steer To Follow Path
Please tell me that how i feed any path to the script?
Thank You.
Hello Arpit,
You do so by creating a pathway for them to follow. Look at the IPathway interface and the Vector3Pathway class for how to define it. You can also read the notes and comments here: http://www.arges-systems.com/articles/213/unitysteer-upcoming-path-following-changes/
Thank You.