Ejemplo n.º 1
0
    public virtual void LateUpdate()
    {
        velocity += steering.LinearMovement * Time.deltaTime;
        rotation += steering.AngularMovement * Time.deltaTime;

        if (velocity.magnitude > maximumSpeed)
        {
            velocity.Normalize();
            velocity = velocity * maximumSpeed;
        }

        if (!steering.IsMovingAngular())
        {
            rotation = .0f;
        }

        if (!steering.IsMovingLinear())
        {
            velocity = Vector3.zero;
        }

        steering = new Steering();
    }