Posts tagged AS3
Steering Behaviors: Wander
Jun 16th
The next steering behavior is wander. It is the next steering behavior in the series. This will use the same Vehicle.as class. If you haven’t read the previous posts, you should, especially the Seeking Behavior. These behaviors are based on Craig Reynolds’ article, Steering Behaviors For Autonomous Characters.
Wander Behavior
Wandering produces a random path. You could add a random number to the velocity each frame, but that would produce a jittery motion. This method creates a smooth and natural feeling motion. To wander, you change the velocity in small amounts each frame.
A More >
Steering Behaviors: Pursuit and Evade
Jun 14th
Up next is pursuit. Again, we will be using the Vehicle.as class. It’s the next on in the steering behaviors series. It is based on Craig Reynolds’ article, Steering Behaviors For Autonomous Characters.
Pursuit Behavior
Pursuit is the most complicated behavior we’ve done so far. To pursue, there needs to be another moving target which you want to pursue. To pursue, you look at the current vehicle, use its current velocity, and predict where it will be in T. Then you simply seek the predicted point. Now pursuit assumes that the other vehicle is More >
Steering Behavior: Fleeing
Jun 12th
Time for the next steering behavior, fleeing. This will use the same Vehicle.as class and will be built off what we did in the seeking behavior. It is based on Craig Reynolds’ article, Steering Behaviors For Autonomous Characters.
Fleeing Behavior
Fleeing is very similar to seeking. It is actually the inverse of seeking. Instead of going towards the target, fleeing goes away from the target. It works like this:
1. desiredVelocity = target – position
2. desiredVelocity is normalized and multiplied by maxSpeed.
3. desiredVelocity is multiplied by -1 to go away from the target
4. steeringForce More >
Steering Behaviors: Seeking
Jun 11th
Steering behaviors are used to create intelligent movements on a computer. These posts will be an AS3 version of the principles illustrated in Craig Reynolds’ article located at http://www.red3d.com/cwr/steer/gdc99/.
Before we can start using steering behaviors, we need a few classes. First we will be using, yet again, the Vector2D.as class. Steering behaviors rely on vector math, so you should be familiar with it.
If you need more information on vector mathematics, you can look here:
https://users.cs.jmu.edu/bernstdh/web/common/lectures/slides_vector-math-2d.php
http://en.wikipedia.org/wiki/Vector_%28mathematics%29
Next we will need a vehicle class to hold all the vehicle’s properties. The properties each vehicle will More >
SAT in Action
May 22nd
In a previous post, I explained the Separation of Axis Theorem. Now it’s time to see SAT in action.
Click on a shape to move it. It both will turn red when they are touching. The shapes will turn black again when they are not colliding. Use the drop down lists to change the shapes.
Separation of Axis Theorem (SAT) for Collision Detection
May 19th
The separating line and axis form a 90 degree angle.
The Separation of Axis Theorem(SAT) is a technique to test whether two convex polygons are colliding. The SAT theorem: “given two convex shapes, there exists a line onto which their projections will be separate if and only if they are not intersecting.” The line where the shapes have disjoint projections is called the separating axis.
A separating line is the line that can be drawn between the two shapes, without touching either shape. Because flash is 2D, I will only be showing this method for 2D, but it can be done in 3D(in 3D, More >





