Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        Vector3 target = path.ProjectDownPath(transform.position, projectionDistance);

        target.y = transform.position.y;
        SteeringSeek.DelegatedSteer(motor, target);

        seekTarget.position = target;
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        currentAnglePosition += Random.Range(-maxDegreeDeltaPerSecond * Time.deltaTime, maxDegreeDeltaPerSecond * Time.deltaTime);
        currentAnglePosition %= 360;

        Vector3 adjustment = Quaternion.AngleAxis(currentAnglePosition, transform.up) * transform.forward;

        adjustment *= ringRadius;

        Vector3 destination = transform.position + transform.forward * ringDistance + adjustment;

        SteeringSeek.DelegatedSteer(myMotor, destination);
    }
Exemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        // How long do I need to get to my target?
        float rangeToTarget = Vector3.Distance(target.position, transform.position);
        float timeToTarget  = rangeToTarget / steeringMotor.maxSpeed;       // d / d / s = s

        if (timeToTarget > maxLookAhead)
        {
            timeToTarget = maxLookAhead;
        }
        // Where will the target be in that time?

        Vector3 targetVelocity = target.GetComponent <Rigidbody>().velocity;

        Vector3 destination = target.position + targetVelocity * timeToTarget;

        SteeringSeek.DelegatedSteer(steeringMotor, destination);
    }