Agent.FixedUpdate C# (CSharp) Méthode

FixedUpdate() private méthode

private FixedUpdate ( ) : void
Résultat void
    private void FixedUpdate()
    {
        // Calculate the total steering force by summing the active steering behaviors
        Vector3 force = Arrive () + ObstacleAvoidance();

        // Upper bound on force
        if (force.magnitude > this.maxForce) {
            force = force.normalized * this.maxForce;
        }

        // Apply the force
        this.rb.AddForce (force, ForceMode.Force);

        // Upper bound on speed
        if (this.rb.velocity.magnitude > this.maxSpeed) {
            this.rb.velocity = this.rb.velocity.normalized * this.maxSpeed;
        }

        UpdateVelocityIndicators (force, rb.velocity);
    }