Java 类com.badlogic.gdx.ai.steer.behaviors.CollisionAvoidance 实例源码

项目:GdxDemo3D    文件:CollisionAvoidanceSteererBase.java   
public CollisionAvoidanceSteererBase(final SteerableBody steerableBody) {
    super(steerableBody);

    this.proximity = new RadiusProximity<Vector3>(steerableBody, GameScreen.screen.engine.characters, steerableBody.getBoundingRadius() * 1.8f);
    this.collisionAvoidanceSB = new CollisionAvoidance<Vector3>(steerableBody, proximity) {
        @Override
        protected SteeringAcceleration<Vector3> calculateRealSteering(SteeringAcceleration<Vector3> steering) {
            super.calculateRealSteering(steering);
            steering.linear.y = 0; // remove any vertical acceleration
            return steering;
        }
    };

    this.prioritySteering = new PrioritySteering<Vector3>(steerableBody, 0.001f) //
        .add(collisionAvoidanceSB);
}