Fish.FixedUpdate C# (CSharp) Méthode

FixedUpdate() public méthode

public FixedUpdate ( ) : void
Résultat void
    void FixedUpdate()
    {
        // apply a physics force in the direction of our destination
        rigidbody.AddForce( ( destination - transform.position ).normalized * Time.fixedDeltaTime * speed, ForceMode.VelocityChange );

        // if fish is near our current destination, then set a new destination
        if ( Vector3.Distance( transform.position, destination ) < stoppingDistance ) {
            SetNewDestination();
        }
    }