-
Notifications
You must be signed in to change notification settings - Fork 5
Wander2DBehavior
Oğuz Eroğlu edited this page Jun 13, 2020
·
4 revisions
Wander2DBehavior makes a steerable wander around on a plane having given normal. This behavior is designed for FPS like games where the steerable does not walk on the gravity axis (usually the axis Y).
This behavior takes the normal vector as a parameter. This vector represents the gravity direction (usually this is Vector3D(0, -1, 0)). It puts an imaginary circle, having the specified normal and wanderCircleRadius units of radius, wanderCircleDistance units away from the steerable towards its current direction. It then calculates a displacement force from its position to a random point on the circle. The random point on the circle changes according to the angleChange parameter each frame.
// create a steerable
var steerable = new Kompute.Steerable("steerable1", new Kompute.Vector3D(), new Kompute.Vector3D(10, 10, 10));
// set the velocity of the steerable (this is not necessary if the steerable has another behaviors)
steerable.velocity.set(-1000, 230, 500);
// create an instance of Wander2DBehavior
var wanderBehavior = new Kompute.Wander2DBehavior({
angleChange: Math.PI / 100,
normal: new Kompute.Vector3D(0, 1, 0),
wanderCircleDistance: 100,
wanderCircleRadius: 50
});
// set the behavior
steerable.setBehavior(wanderBehavior);- Core
- Path
-
Steering Behaviors
- AlignBehavior
- ArriveBehavior
- AvoidBehavior
- BlendedSteeringBehavior
- CohesionBehavior
- EvadeBehavior
- FleeBehavior
- HideBehavior
- JumpBehavior
- LookWhereYouAreGoingBehavior
- PathFollowingBehavior
- PrioritySteeringBehavior
- PursueBehavior
- RandomPathBehavior
- RandomWaypointBehavior
- SeekBehavior
- SeparationBehavior
- Wander2DBehavior
- Wander3DBehavior
- Math
- Extra