Articles

UnitySteer 2.1 released

61

Update: UnitySteer 2.2 is the latest stable version.

Want to see UnitySteer in action? We’re using it for our own game, click here for a preview.

After a few months of polish, I’ve allowed version 2.1 of UnitySteer to escape (which is to say I’ve merged the code that has been live this whole time into master, and won’t be altering its behavior for a few months). You can find it on GitHub, and as usual can press that nice Downloads button there to get a zipped version of the release.

I’ve yet to update UnitySteerExamples, as I’m rather tied up. That’ll have to wait until a later date.

Path following

I’ve detailed most of the path following changes on a previous post. I recommend you go over it, as it details the use and rationale behind the new SteerForPathSimplified and other classes.

AutonomousVehicle and Vehicle changes

I’ve extracted several values that were originally constants to a property you can configure. When introducing a new configurable value, I’ve aimed to keep the same behavior as before by defaulting it to the previous constant, but as usual please commit your code and test thoroughly.

POSSIBLY BREAKING CHANGE: Added ArrivalRadius to Vehicle, to separate the concept of the vehicle’s volume/area from when it’s close enough to its target. The previous behavior could have considered arrival when the target point was within the vehicle’s radius, but in some cases you don’t want the vehicle to just be touching the point, but to be within a certain minimum distance. You can use ArrivalRadius to specify this arrival value.

AutonomousVehicle now allows you to disable the acceleration blending. Simply set AutonomousVehicle’s AccelerationSmoothRate to 0, or change to any value between 0 and 1 to configure the blending rate you need.

Vehicle.GetSeekVector previously always considered the Vehicle’s current speed in his calculations to the point, to create an arrival effect where the vehicle slowing down when closer to its target. This had the side effect that if you were using GetSeekVector to follow a series of points, the vehicle would look like it was accelerating and decelerating all the time. I’ve added considerVelocity as a parameter, which if set to false will allow you to tell it to skip the arrival calculation. The default is still the same behavior as before.

Added VehicleLookAtOverride behavior. The previous change had the side effect that a vehicle could approach its target too fast at a bad angle, and go into a circle like a car spinning in place. VehicleLookAtOverride will allow you to override the blending value on the vehicle, to turn the transform towards the point the vehicle would have been led by the raw, unclipped force being applied (before MaxSpeed and MaxForce are considered).

Zeroing the Y force for planar vehicles before the force and speed even get clamped. This may have an effect on your previously created vehicles, but it shouldn’t alter their behavior significantly. I’d rather not do these sort of changes after release, but the alternative was forking AutonomousVehicle.

AutonomousVehicle now takes into account its CanMove value. If CanMove is FALSE, the forces are still calculated, but the vehicle does not update its position. If you want to avoid calculating the forces altogether simply disable the vehicle.

AutonomousVehicle no longer evaluating HasInertia, and will log an error on Start if it finds it to be true. All the steering behaviors I’ve created assume “Star Wars physics” for their calculations, where if you stop applying a force to the object it should stop. This means that HasInertia should be false. No longer evaluating the value on AutonomousVehicle to avoid the confusion caused by the vehicle not acting as expected, and added a warning on vehicle start. If for any reason you have an agent using AutonomousVehicle that depends on inertia, you’ll need to modify this class manually.

OnArrival

Added OnArrival to Steering. Now every steering behavior will raise an OnArrival message when it would first stop moving (if on its previous evaluation it had returned a force, and on this one it no longer does so, meaning the behavior considers it has arrived at its destination). To use, simply assign the OnArrival delegate of your Steering behaviors:


_steerForPath.OnArrival = OnArrival;

// [...]

 

protected void OnArrival(SteeringEvent<Vehicle> message)
{
// Do Something
}

Any receiver of an OnArrival call can now tell the vehicle to retry once by setting the SteeringEvent’s Action property to ‘retry’. This is useful if you don’t want the steering behavior to skip a beat when it has arrived at the designated spot and needs to await instructions from the receiver (as otherwise the value returned might get cached for a few frames).

Other changes

  • BUGFIX: Setting the Tick’s TickLapse will reset the next tick time. As it was previously, the behavior wouldn’t be ticked again until the time defined by the previous TickLapse value, something I noticed while having a behavior that changed the TickLapse when the agent was idling.
  • Documented the actual state of SteerToFollowPath.
  • Removed PolylinePathway. Use Vector3Pathway instead.

That’s it for now. Enjoy!

  1. Joren
    Joren02-21-2011

    Excited to play more with some of these new options. One thing I can’t figure out is how to avoid this behavior:

    http://www.youtube.com/watch?v=hwIfiiQJjAk

    The only thing I can do to make it not crash right into those 3 blocks is to up the max force value to 40+ which creates super jerky velocity swings as it navigates around. Any insight for good settings for this type of situation?

    • Ricardo J. Méndez
      Ricardo J. Méndez02-21-2011

      Hello Joren,

      From the look of things, you have a relatively short MinTimeToCollision. Your value of 1 means that the vehicle will disregard any obstacles with which it’s not likely to collide in under 1 second. The stronger force might work for you because it means the vehicle makes harder turns when it does notices them. Try keeping the same forces/speed you have, but increasing the MinTimeToCollision and – if necessary – the radar’s detection radius.

      Some other notes:

      * When you have a tight grouping of obstacles such as these, you’re better off considering them as a single obstacle. Instead of creating three separate spherical obstacles, create a single one that encompasses all three.
      * Assuming your obstacles are static, you’d be better off punching a hole in the navmesh where the obstacles are, particularly as the group’s layout is concave.

      By the way, thanks for including the video at a nice resolution. Seeing your parameters helped me get an idea of what was going on. Cheers!

  2. Joren
    Joren02-21-2011

    Thanks for the fast response! Tweaking min-time-to-collision doesn’t help in this case. I’ve tried values between 0 and 20.

    How do I punch a hole in the navmesh? I wasn’t even aware this used a navmesh when you’re using only steering and not pathing.

    • Ricardo J. Méndez
      Ricardo J. Méndez02-22-2011

      What I mean is that this is a problem better solved by pathfinding, so if you’re going to be encountering many such configurations of obstacles, you’re better off creating a navmesh, generating a path from it, and using one of the pathfollowing classes.

      • Joren
        Joren02-22-2011

        Oh ok. I’ll definitely give that a shot.

  3. Joren
    Joren02-21-2011

    Hmm. Is there any way to group gameobjects so they’re considered to be one big object for the purposes of the radar, but are still individual cubes for the rest of my game’s purposes?

    • Ricardo J. Méndez
      Ricardo J. Méndez02-22-2011

      If you want them to be objects that can be moved independently when running the game, not right now. If you want them to be static obstacles, then yes: you could just add a SphericalObstacleData to the central one and override the obstacle radius to encompass all three.

      • Joren
        Joren02-22-2011

        Cool. This is what I ended up doing. Thanks for the help.

  4. John
    John02-23-2011

    I’m trying to get the source code as well as do some tutorials to integrate UnitySteer into my project but the first problem I’m running into is using namespace PathLibrary. This is also in to AngryAntPathWay.cs script. Is this outdated and I should be using something else?

    Thanks
    -John

  5. John
    John02-23-2011

    Also, I’m interested in having logic for stop signs and stop lights in an urban environment. What would be a good script to use for that purpose?

    • Ricardo J. Méndez
      Ricardo J. Méndez02-24-2011

      Nothing out of the box. Since the behavior of agents at a stop sign would vary – pedestrians cross when the light is red, whereas cars are supposed to stop in the same situation – that’s more the domain of agent behavior and not steering. See AngryAnt’s Behave for a possible tool: http://angryant.com/behave/

  6. John
    John02-24-2011

    Thanks for the prompt reply, it helped me.
    The next question I have is I want to have gameobjects follow a path whether it be based on waypoints or whatever is chosen. Playing with the scripts I don’t see which one I need to do this. Also, I need said gameobjects to avoid their neighbors which I’m guessing I can use SteerForNeighbor or SteerForNeighborAvoidance to accomplish that.

    One last thing, is this the right place to post questions like this or is there a forum specific to UnitySteer questions I should be asking instead?

    Thank you again.

    • Ricardo J. Méndez
      Ricardo J. Méndez02-25-2011

      To follow a path, you would use SteerForPathSimplified – as described on that article – and you would need to convert the waypoints (or whatever you choose) into a series of Vector3s defining said path.

      No specific forum, as far as questions go, so feel free to ask here – I check the site more often than I check the Unity forums or UnityAnswers.

      • John
        John02-25-2011

        Thanks, another quick question I have is does UnitySteer apply forces through physics or does it set the positional/rotational data frame by frame?

        • Ricardo J. Méndez
          Ricardo J. Méndez02-26-2011

          AutonomousVehicle can do either. If the agent doesn’t have a rigidbody or has a kinematic one, it’ll alter the transform’s position directly. If it does have a non-kinematic rigidbody, it will call its MovePosition method, which will respect physics.

          You can also change this behavior by creating your own AutonomousVehicle descendent.

  7. John
    John03-01-2011

    Thanks for all the help, you’ve been great. Another question that is probably relatively simple to answer but I just don’t know is I’m trying to simulate two lane traffic and prevent the vehicles from bumping into each other. Is there a built-in script in UnitySteer that will allow this out of the box or will I need to do some modification on my end as well?

    All I really need is collision prevention so vehicles aren’t running into each other and will stop fairly smooth if it sees another vehicle within a certain distance and resume it’s path after the vehicle is gone.

    Thank you.

    • Ricardo J. Méndez
      Ricardo J. Méndez03-02-2011

      You also need constrained lane movement. The public UnitySteer behaviors will try to navigate around obstructions, so they’re not suited to this behavior. What I’d suggest as a start is creating your own neighbor avoidance behavior that, when the neighbor is going in a similar direction (as defined by their headings) then your behavior aims for a spot behind the neighbor’s future position, instead of aiming to drive around it.

      • John
        John03-02-2011

        Thanks, I assumed something like that just wasn’t sure the details. I plan on watching a couple video tutorials on AI behaviour trees you recommend on the site before touching Behave.

        One more thing that might be simple but I can’t figure out how to get it looking good is setting the mass and not having speed slow down dramatically. I set the mass to 100 just to see what happens and now the vehicles aren’t moving. I tried the “override rigidbody mass” and set it on AutonomousVehicle but it still results in the vehicle moving. When I set mass back to 1 the vehicle moves fine. Is there something else I need to be doing to adjust for the mass of the vehicle because a mass of 1 is way to light for a vehicle.

        Thanks again for all your help.
        -John

  8. Joren
    Joren03-04-2011

    I’m attempting to implement the A* pathfinding project with UnitySteer. I’m using the SteerForPoint behavior to iterate through my nodes. My problem is that I can’t figure out how to use the OnArrival message. Could you go a little bit more in depth about what you might need include or extend to get this to fire?

    • Joren
      Joren03-04-2011

      I forgot to mention, the error I’m getting is: Assets/Game/Scripts/VehiclePathfinding.cs(13,34): error CS0246: The type or namespace name `SteeringEvent’ could not be found. Are you missing a using directive or an assembly reference?

      When I put in the OnArrival function you posted above.

      • John
        John03-04-2011

        SteeringEvent isn’t a namespace, it’s the class. You want to have ‘using namespace UnitySteer.Helpers’ at the top of your file and it should resolve the compile error.

        • Joren
          Joren03-04-2011

          With this I still get the compile error:

          using System.Collections;
          using System.Collections.Generic;
          using UnityEngine;
          using UnitySteer;
          using UnitySteer.Helpers;

          namespace UnitySteer.Helpers {
          public class VehiclePathfinding2 : MonoBehaviour {

          • John
            John03-05-2011

            Is that your script? I don’t think you need the ‘namespace UnitySteer.Helpers {‘ line.

    • John
      John03-04-2011

      How come you chose to use SteerForPoint instead of SteerForPointSimplified? I believe it should handle most what you need.

      I’m using C# but hopefully this helps you even if you’re using JS.

      In my script I have it creating a path and I have an ArrayList named path. Here’s my code:
      Steer = gameObject.GetComponent(“SteerForPathSimplified”) as SteerForPathSimplified;

      Steer.Path = new Vector3Pathway(path, 0.5f, false);

      Steer.OnArrival = OnArrival;

      As you can see I called OnArrival from Steer variable that’s type SteerForPathSimplified.

      I then declare the function OnArrival that looks like this:

      void OnArrival(SteeringEvent message)

      {

      Destroy(gameObject);

      }

      As you can see I just want to destroy the gameobject when it reaches it’s destination.

      • Joren
        Joren03-04-2011

        I’m using SteerForPoint because SteerForPathSimplified is set up specifically to work with Angry Ant’s Path which as far as I can tell doesn’t generate its own navmesh. What I’m doing right now which is working great is doing SteerForPoint on each waypoint of the path in turn. I do a check on FixedUpdate if you’re within X distance of your destination waypoint, then target the next one in the chain.

        I’m not even sure if OnArrival will work better than my method anymore, because I hacked my own message that sends at the same time and the vehicle hitches every time it hits a waypoint before it starts heading for the next one. My way I make sure my waypoint radius is larger than my arrival radius and it never hitches.

        • Ricardo J. Méndez
          Ricardo J. Méndez03-04-2011

          Actually, SteerForPathSimplified is not meant for AngryAnt’s Path at all – it’s meant for receiving a series of Vector3’s and it doesn’t particularly care where you got it from. Navmeshes, Path, or waypoint grids do not feature into it – it only cares about the waypoints themselves.

  9. John
    John03-04-2011

    I have a question about SteerForWander and SteerForTether. Right now I’m using them combined on the same object to wander and not allow the object to stray the distance set in SteerForWander. Is there a way with the current UnitySteer to define a nav mesh area to keep the object from wandering off of; for instance a sidewalk and don’t allow the object to wander off the sidewalk into the road?

    Thanks again,
    -John

    • Joren
      Joren03-04-2011

      You could border the sidewalk with gameobjects and SteerForObstacleAvoidance. Perhaps not as elegant, but it would work.

    • Ricardo J. Méndez
      Ricardo J. Méndez03-04-2011

      Not quite, though you could hack it. *INELEGANT SOLUTION WARNING*: one could place a series of evenly spaced waypoints across the center of the sidewalk, and have the vehicle tether to the closest one. That, however, is horrible.

      A better way is to make a pathway and ensures that the object’s path following remains within the channel defined by the path, something that SteerForPathSimplified doesn’t yet do. A *much* better way would be changing pedestrian behavior depending on the region they’re on, something I have a draft plan for but did not get around to it yet, as it does not fit into/is not necessary for the game we’re building.

      • John
        John03-05-2011

        OK, thanks for the replies guys, we’ll play with different ways and let you know what we decided to go with.

      • John
        John03-15-2011

        OK one thing I’m trying is making a cube with no mesh renderer so you don’t see it in game with a box collider that’s a trigger. When the object “exits” the trigger it calls OnTriggerExit and I want to change the direction they are traveling but it doesn’t seem I can do this to easily as _wanderSide variable is private.

        Is there another way I am able to change the direction the civilian is walking so when OnTriggerExit is hit it basically goes the opposite direction so it stays in the collider area?

        -John

  10. Joren
    Joren03-07-2011

    Is there any functionality for making a vehicle slow down to make tight turns? Perhaps this would be something that would be good to add in AutonomousVehicle if it is there and I’m just not seeing it. I’m finding that on faster vehicles they always overshoot sharp turns instead of slowing down to turn sharper.

  11. Joren
    Joren03-07-2011

    I’m trying to implement SteerForPathPredictiveTrivial but I’m having trouble creating a Vector3Pathway.

    When I try to create a new IList to feed into the Vector3Pathway I get this error:

    Assets/Game/Scripts/VehiclePathfinding.cs(84,44): error CS0144: Cannot create an instance of the abstract class or interface `C5.IList’

    • Ricardo J. Méndez
      Ricardo J. Méndez03-08-2011

      Hello Joren,

      First, you should read up on the difference between C# interfaces and classes. You cannot instantiate an interface, and instead instantiate an implementor class, like C5.ArrayList.

      Second, I don’t recommend using any of the *Trivial classes – as I mentioned on that previous post that describes them, they are sample classes only with some well-documented drawbacks. If you must, use SteerForPathSimplified.

      http://www.arges-systems.com/articles/213/unitysteer-upcoming-path-following-changes/

  12. Artem Koval
    Artem Koval03-08-2011

    Hi!

    It may be a dumb question but is this library 3D oriented (can I use it in full 3D such as space)?

    Best regards, A. Koval.

    • Ricardo J. Méndez
      Ricardo J. Méndez03-08-2011

      Hello Artem,

      Yes, as you can see on the boids examples. Just don’t set your vehicle to planar.

      • Artem Koval
        Artem Koval03-18-2011

        Thanks for response!

        I should try it in the nearest future.

        A. Koval

  13. John
    John03-10-2011

    One issue I’ve ran into recently and I’m not sure how it creeped into my software that you may know. I’m using OnArrival for when the vehicles reach the last point and call Destroy(gameObject). However the issue I’m seeing is when I create the GameObject it immediately goes into OnArrival and as a result destroys my gameObject. I can get around this by not creating the vehicle when the scenario starts but the other issue I’m seeing is if the vehicle slows down (by my logic using Behave, simply just sets their speed to the vehicle in front unless the vehicle is cutting in front of them perpindicularly) it trigger OnArrival.

    Do you know what can cause this? I’ve looked at your logic a bit and I think I know what’s going on and why but it doesn’t make sense I’m just not seeing this.

    Any help on this issue is appreciated.

    -John

    • Ricardo J. Méndez
      Ricardo J. Méndez03-10-2011

      Hi John,

      I noticed that after release – the issue is that Steering.ReportedArrival defaults to false. If you want to work around this, just set ReportedArrival = true on Steering.Awake().

      • John
        John03-10-2011

        Ricardo,

        Will this also fix the issue when the vehicles are already on their paths, someone cuts in front of them and they slow down or stop they are being destroyed because OnArrival is being called?

        Thanks,
        -John

        • Ricardo J. Méndez
          Ricardo J. Méndez03-10-2011

          Hi John,

          It’ll depend on what you’re doing. SteerForPathSimplified will only raise the OnArrival event when it reaches the end of the path – it does it when the force for the behavior is Vector3.zero, and that should be the only case. A vehicle in its path would cause another behavior to return a force which will affect vehicle motion, but should not affect the result of the path following behavior.

          • John
            John03-11-2011

            I’ve tried two things and have gotten different, but not perfect results.

            The first was in the Behave script I created if there is a vehicle that is crossing the vehicle in question’s path and it is close enough, I drop the Speed of AutonomousVehicle component to 0.0f. This is causing them to trigger OnArrival. If I change MaxSpeed however, it won’t trigger OnArrival. Is there a better method or variable to adjust the speed than one of these?

            -John

          • Ricardo J. Méndez
            Ricardo J. Méndez03-11-2011

            I’m afraid there isn’t a better simple option – the better alternative would be to create another behavior which corrects course or – in an attempt to stop the vehicle – returns a speed vector opposite to the vehicle’s current acceleration on this situation.

    • Anomalous Underdog
      Anomalous Underdog04-04-2011

      So you want a gameobject to be destroyed once it reaches its destination? Why don’t you just check the sqrMagnitude between its position and the destination position and check if it gets below a certain value? Its not elegant but its sure to work.

  14. John
    John03-11-2011

    That’s fine, I just wanted to make sure I was changing the correct variable. I’ll find a work around, you’ve been most helpful again.

    -John

  15. SIegeon
    SIegeon04-03-2011

    I am trying to integrate unitySteer into my game, with the goal of have a bunch of characters roaming around until assigned a target. Once they have a target they should pursue that target, and when they get close, attack. For testing I am currently only working with one steering behavior, the steer for pursuit. To accomplish the task of chasing down a target I have started with an empty GameObject to which I added an Autonomous Vehicle, a Steer For Pursuit, and a targeting AI. The AI adds the attached autonomous vehicle to a list stored in _characterManager, and when the character does not have a target, the AI will ask the _characterManager for a target. The _characterManger simply runs through the list of characters and finds the closest of the opposite faction. This is working as indented.

    The issue is that the characters when spawned will not pursue their targets. By that I mean if I place one of the good guys and one of the bad guys in the scene before pressing play, then as soon as the game starts they will select each other as targets, and walk at each other, as expected.

    If I instead allow the characters to be spawned then they will select the correct targets, but they will not peruse their target, and instead will just sit at their spawn point. Spawning a character is instantiation based off a timer, one new character is made at the good guy spawn point, and the bad guy spawn point about every 4 seconds. Interestingly enough if I wait and allow tons of characters to spawn eventually one of the cloned characters will behave correctly, but it is basically random, and the characters spawned at the working one don’t work either. When I inspect the character that behaves as expected it is exactly the same as the rest of the characters.

    I posted a video of the issue to youtube, and thought maybe someone here may know how to fix this problem, I’m sure its something I am overlooking.

    http://www.youtube.com/watch?v=-J7cAy8zaCo

  16. SIegeon
    SIegeon04-04-2011

    With a good nights rest I was able to determine the problem, for what ever reason the behavior steer for pursuit is instantiating as disabled randomly. To fix this I first tried to enable the script in the awake and start function of my character class. This did not work, but if I put a check in the update, the the issue is resolve. IE

    if(_mySteerForPursuit.enabled == false){_mySteerForPursuit.enabled = true}

    • Ricardo J. Méndez
      Ricardo J. Méndez04-04-2011

      Hello Siegeon,

      Glad you found it. Indeed, SteerForPursuit’s CalculateForce method sets itself to disabled when called and it doesn’t have a quarry. You could also change that specific line to avoid having to do your Update check override.

      • SIegeon
        SIegeon04-04-2011

        Yep that worked, thank you. Also there is some strange behavior when when two targets are targeting each other, when they get close their targets suddenly change to a new point off in the distance (this can also be seen in the video. Any thoughts on how to prevent that.

        • Ricardo J. Méndez
          Ricardo J. Méndez04-05-2011

          At which point in the video does this happen?

          Off the top of my head, here’s what I can suggest: SteerForPursuit won’t make your agent aim for its target, but for its future position. I wonder if what you’re seeing is a case of the agent getting close enough, but still aiming for a future spot. If so, you could try hooking up the OnArrival notification for SteerForPursuit and having your agent look at the target when you receive it. Another option is modifying SteerForPursuit so that when it’s under a certain distance from its quarry, it starts aiming for the quarry and not its future position. Yet another possibility would be tweaking the timeFactor so that the prediction time is shorter on these cases.

  17. SIegeon
    SIegeon04-05-2011

    At about 43 seconds the two characters switch from heading strait at each other and the bottom character heads to his left, and the top character heads to his right, I can post another video of the debug lines, but it happens every time. As soon as two agents get close to each other (like a distance of 5ish) they change their targets to a position that neither target is at, then they meet at a point. In the video you can see that instead of meeting some where in the middle they characters very to the side of the screen. I will play the both the OnArrival,and the timeFactor some this morning. Also thank you so much for you help!

  18. siegeon
    siegeon04-05-2011

    I do not quite understand how to set up the OnArrival delegate. I am still new to C# and I have not worked with delegates before. Tried to follow your example listed above

    steerForPath.OnArrival = OnArrival;
    protected void OnArrival(SteeringEvent message)
    {
    Attack();
    }

    Visual Studio tells me that I am missing the type or namespace for SteeringEvent, but even when I add using UnitySteer.helpers, It does not resolve. I am sorry to bother you with a question like this, but I have had any luck figuring it out.

    • Ricardo J. Méndez
      Ricardo J. Méndez04-06-2011

      SteeringEvent is a generic class, and OnArrival receives a SteeringEvent of Vehicle. This was something that the pseudocode above failed to clear up, since it took it the generic declaration as an unknown tag and hid id, so I’ve updated it.

      • SIegeon
        SIegeon04-06-2011

        Must have been staring at the code to long, makes perfect since now.Thank you so much for your time!

  19. Tom
    Tom04-21-2011

    Hi This maybe a silly question but is there a simple way to name the direction of the forward vector for AutonomousVehicle ? I have been using a test model in my game that has been moving around backwards in a wandering example. I have a prefab set up which I can’t seem to correct it’s direction for some reason by simple rotation of the base model prior to attaching UnitySteering scripts.

    Also I noticed that the UnitySteerExamples have simple animations playing in a loop like for walking kittens. Is there a simple way of crosswalking different animations within UnitySteer without directly editing the core behavior scripts?

    I think it would be cool to create a drag and drop component that you could assign (map) animations to vector movement types. Say like walking, side stepping, or turning, and stopping.

    Do you have any examples on what the Editor scripts are used for? Sometimes I get strange errors at random that say no editor script found for AutonomousVehicleEditor…

    • Ricardo J. Méndez
      Ricardo J. Méndez04-22-2011

      Hello Tom,

      I have been using a test model in my game that has been moving around backwards in a wandering example. I have a prefab set up which I can’t seem to correct it’s direction for some reason by simple rotation of the base model prior to attaching UnitySteering scripts.

      Your model is not looking towards of its forward vector. Try flipping it on your editor, or when in Unity scaling it on the Z axis by -1.

      Is there a simple way of crosswalking different animations within UnitySteer without directly editing the core behavior scripts?

      I think it would be cool to create a drag and drop component that you could assign (map) animations to vector movement types. Say like walking, side stepping, or turning, and stopping.

      Such changes are more the domain of an animation blend tree than a steering component, but unfortunately Unity lacks one of those. There seem to have been some community attempts such as this one, but there aren’t any news from it since July 2010.

      Do you have any examples on what the Editor scripts are used for? Sometimes I get strange errors at random that say no editor script found for AutonomousVehicleEditor…

      These are used for referencing property setters and getters that Unity’s inspector would otherwise not give you access to, and while they work automagically they should be pretty self-explanatory if you check them. If Unity is giving you random errors that it cannot find AutonomousVehicleEditor when the file is on the project, please report it to Unity as a bug with a repro case.

      • Tom
        Tom04-22-2011

        Ok. So the Editor scripts are not directly used for anything right? I get the editor script error sometimes when I publish standalone builds.

        Thanks Ricardo. I’ll take a look at the Animation Blending video. What I’m thinking of though doesn’t need to be as complicated. For example you could have default animations named if an animation component exists. So that OnArrival plays a “idle” animation for example. You let each default type take an “animation” string to use like:

        public string onArrivalAnimationName; // idle
        public string forwardAnimationName; // walking
        a = (Animation)GetComponentInChildren(typeof(Animation));
        if (a != null)
        {
        a.wrapMode = WrapMode.Loop;
        a.Stop();
        a.Play(forwardAnimationName);
        }
        void OnArrival() {
        if (a!=null) {
        a.CrossFade(onArrivalAnimationName);
        a[onArrivalAnimationName].normalizedSpeed = 1.0F;

        Although I understand nothing is ever that easy. Just thought we could take a stab at this somehow. Define default animations for direction / motion type. Make it as basic as possible for initial tests.

  20. Elie
    Elie05-03-2012

    Hi Ricardo,

    I want to know if its possible with UnitySteer to create multiple units move in a formation without bumping into each other similar to how units move in Galcon game. If yes what are the C# componnents that needs to be added for each units ?

    And by the way thank you for this great plugin.

    • Ricardo J. Méndez
      Ricardo J. Méndez05-03-2012

      I haven’t really played Galcon, so I’m not sure about their formations. UnitySteer is focused on autonomous agents, and if you want some strong formations you may need to write a controller or coordinator that assigns each a spot from a point of reference (a leader). If all you need is to have them grouped, SteerToFollow and SteerForSeparation might be enough, as shown here: http://arges-systems.com/blog/2012/04/13/quick-steertofollow-example/ (or perhaps even just SteerForPoint and SteerForSeparation).

Leave a Reply