// Update is called once per frame
    void Update()
    {
        _velocity = _velocity + getSteering()._linear *Time.deltaTime;  // Vt = Vo +a.t

        if (_velocity.magnitude > _maxSpeed)
        {
            _velocity = _velocity.normalized * _maxSpeed;
        }

        this.transform.position    = transform.position + _velocity * Time.deltaTime;
        this.transform.eulerAngles = SteeringData.getNewOrientation(transform.eulerAngles, _velocity);
    }
    // Update is called once per frame
    void Update()
    {
        //lengkapi Update
        _steeringAll = getSteering()._linear + getCollideAvoid()._linear; // Vt = Vo +a.t
        _velocity   += _steeringAll * Time.deltaTime;

        if (_velocity.magnitude > _maxSpeed)
        {
            _velocity = _velocity.normalized * _maxSpeed;
        }

        this.transform.position   += _velocity * Time.deltaTime;
        this.transform.eulerAngles = SteeringData.getNewOrientation(transform.eulerAngles, _velocity);
    }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        _velocity = _velocity + getSteering()._linear *Time.deltaTime;  // Vt = Vo +a.t

        if (_velocity.magnitude > _maxSpeed)
        {
            _velocity = _velocity.normalized * _maxSpeed;
        }
        this.transform.position    = transform.position + _velocity * Time.deltaTime;
        this.transform.eulerAngles = SteeringData.getNewOrientation(transform.eulerAngles, _velocity);

        if (Result() > 0 && currentWp < waypoints.Count - 1)
        {
            currentWp++;
            _target = waypoints[currentWp];
        }
    }