Example usage for com.badlogic.gdx.math Vector3 clamp

List of usage examples for com.badlogic.gdx.math Vector3 clamp

Introduction

In this page you can find the example usage for com.badlogic.gdx.math Vector3 clamp.

Prototype

@Override
    public Vector3 clamp(float min, float max) 

Source Link

Usage

From source file:br.cefetmg.games.movement.behavior.Chegar.java

public Direcionamento guiar(Pose agente) {
    Direcionamento output = new Direcionamento();
    Vector3 objetivo = new Vector3(this.alvo.getObjetivo());
    Vector3 velocidade = objetivo.sub(agente.posicao);
    if (velocidade.len2() > 3000) {
        output.velocidade = velocidade.clamp(maxVelocidade, maxVelocidade);
    } else {/* w w  w  .  j a v a  2 s.c om*/
        output.velocidade = velocidade.clamp(0, maxVelocidade / 2);
    }
    return output;
}