Example usage for com.badlogic.gdx.ai.steer.utils.rays SingleRayConfiguration SingleRayConfiguration

List of usage examples for com.badlogic.gdx.ai.steer.utils.rays SingleRayConfiguration SingleRayConfiguration

Introduction

In this page you can find the example usage for com.badlogic.gdx.ai.steer.utils.rays SingleRayConfiguration SingleRayConfiguration.

Prototype

public SingleRayConfiguration(Steerable<T> owner, float length) 

Source Link

Document

Creates a SingleRayConfiguration for the given owner where the ray has the specified length.

Usage

From source file:toniarts.openkeeper.world.creature.CreatureControl.java

License:Open Source License

public void wander() {

    // Set wandering
    PrioritySteering<Vector2> prioritySteering = new PrioritySteering(this, 0.0001f);
    RaycastCollisionDetector<Vector2> raycastCollisionDetector = new CreatureRayCastCollisionDetector(
            worldState);//from ww w.j  a  v  a2 s.  c  o  m
    RaycastObstacleAvoidance<Vector2> raycastObstacleAvoidanceSB = new RaycastObstacleAvoidance<>(this,
            new SingleRayConfiguration<>(this, 1.5f), raycastCollisionDetector, 0.5f);
    prioritySteering.add(raycastObstacleAvoidanceSB);
    prioritySteering.add(new Wander<>(this).setFaceEnabled(false) // We want to use Face internally (independent facing is on)
            .setAlignTolerance(0.001f) // Used by Face
            .setDecelerationRadius(5) // Used by Face
            .setTimeToTarget(0.1f) // Used by Face
            .setWanderOffset(10) //
            .setWanderOrientation(10) //
            .setWanderRadius(10) //
            .setWanderRate(FastMath.TWO_PI * 4));
    setSteeringBehavior(prioritySteering);
}