// Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 2: Calculate the closest point in the range [0,1] from this gameobject to the path
    }
Exemple #2
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        //path = GetComponent<BansheeGz.BGSpline.Components.BGCcMath>();
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        path = new UnityEngine.AI.NavMeshPath();
    }
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point from the tank to the curve

        //float min_dist = float.MaxValue;
        //int closestPoint = 0;
        //for (int i = 0; i < curve.Curve.PointsCount; ++i)
        //{
        //    float newDist = Vector3.Distance(transform.position, curve.Curve[i].PositionWorld);
        //    if (newDist < min_dist)
        //    {
        //        min_dist = newDist;
        //        closestPoint = i;
        //    }
        //}
        //trgPoint = closestPoint;

        //totalPathDist = path.GetDistance();//If you don't put anything you get the total distance of the path

        //float distance = 0f;
        //transform.position = path.CalcPositionByClosestPoint(transform.position, out distance);
        //trgPointIdx = path.CalcSectionIndexByDistance(distance);
        //currRation = trgPointRation = distance / totalPathDist;
    }
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point from the tank to the curve
    }
 // Use this for initialization
 void Start()
 {
     move     = GetComponent <Move>();
     seek     = GetComponent <SteeringSeek>();
     arrive   = GetComponent <SteeringArrive>();
     Movenemy = enemy.GetComponent <Move>();
 }
 // private
 // Start is called before the first frame update
 public override void OnStart()
 {
     agent = gameObject.GetComponent <NavMeshAgent>();
     agent.updatePosition = false;
     seek = gameObject.GetComponent <SteeringSeek>();
     base.OnStart();
 }
Exemple #8
0
 void Start()
 {
     move       = GetComponent <Move>();
     seek       = GetComponent <SteeringArrive>();
     steer      = GetComponent <SteeringSeek>();
     police     = GetComponent <NavMeshAgent>();
     m_animator = GetComponent <Animator>();
 }
    // 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;
    }
Exemple #10
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        path.CalcPositionByClosestPoint(transform.position, out current_percentage);
        distance_ratio      = move.max_mov_velocity / path.GetDistance();
        current_percentage /= path.GetDistance();
    }
 void Start()
 {
     //TODO ALIGN THROUGH STEERING
     agent = GetComponent <NavMeshAgent>();
     seek  = GetComponent <SteeringSeek>();
     aling = GetComponent <SteeringAlign>();
     agent.updatePosition = false;
     //agent.updateRotation = false;
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        float distance;

        closest_point = path.CalcPositionByClosestPoint(transform.position, out distance);
        current_ratio = distance / path.Curve.Points.Length;
    }
Exemple #13
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point in the range [0,1] from this gameobject to the path
        path.CalcPositionByClosestPoint(transform.position, out current_percentage);
        distance_ratio      = move.max_mov_velocity / path.GetDistance();
        current_percentage /= path.GetDistance();
    }
Exemple #14
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();
        //    path = GetComponent<FollowCurve>().path;

        // TODO 1: Calculate the closest point from the tank to the curve
        current_point  = path.CalcPositionByClosestPoint(transform.position, out current_ratio);
        current_ratio /= path.GetDistance();
    }
Exemple #15
0
    // Use this for initialization
    void Start()
    {
        move   = GetComponent <Move>();
        arrive = GetComponent <SteeringArrive>();
        seek   = GetComponent <SteeringSeek>();
        align  = GetComponent <SteeringAlign>();
        Vector3 x = Vector3.zero;

        path = new NavMeshPath();
    }
Exemple #16
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 2: Calculate the closest point in the range [0,1] from this gameobject to the path
        closest_point = path.CalcPositionByClosestPoint(transform.position, out point_distance);
        tot_distance  = path.GetDistance();
        current_pos   = point_distance / tot_distance;
    }
Exemple #17
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point from the tank to the curve
        float distance;

        closest_point = path.CalcPositionByClosestPoint(move.transform.position, out distance);
        current_ratio = distance / path.GetDistance();
    }
Exemple #18
0
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point in the range [0,1] from this gameobject to the path
        float distance;

        closet_point = path.CalcPositionByClosestPoint(transform.position, out distance);

        range_distance = distance / path.GetDistance();
    }
Exemple #19
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);
    }
Exemple #20
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);
    }
    // Use this for initialization
    void Start()
    {
        move = GetComponent <Move>();
        seek = GetComponent <SteeringSeek>();

        // TODO 1: Calculate the closest point in the range [0,1] from this gameobject to the path
        math = path.GetComponent <BGCcMath>();

        Vector3 clospoint = math.Curve.Points[0].PositionWorld;

        for (int i = 0; i < math.Curve.PointsCount; i++)
        {
            Vector3 distance_tank = transform.position - clospoint;
            Vector3 distance      = transform.position - math.Curve.Points[i].PositionWorld;

            if (distance.magnitude < distance_tank.magnitude)
            {
                clospoint = math.Curve.Points[i].PositionWorld;
            }
        }

        currpoint = clospoint;
    }
Exemple #22
0
 void Start()
 {
     seek  = GetComponent <SteeringSeek>();
     agent = GetComponent <NavMeshAgent>();
     //ChangeTarget();
 }
 void Start()
 {
     seekTarget = GetComponent <SteeringSeek>();
     mRigidBody = GetComponent <Rigidbody>();
 }
 // Use this for initialization
 void Start()
 {
     move     = GetComponent <Move>();
     prev_pos = transform.position;
     seek     = GetComponent <SteeringSeek>();
 }
Exemple #25
0
 // Use this for initialization
 void Start()
 {
     move  = GetComponent <Move>();
     seek  = GetComponent <SteeringSeek>();
     timer = wanderRate;
 }
Exemple #26
0
 // Use this for initialization
 void Start()
 {
     seek = GetComponent <SteeringSeek>();
     ChangeTarget();
 }
 // Use this for initialization
 void Start()
 {
     move = GetComponent <Move>();
     seek = GetComponent <SteeringSeek>();
 }
Exemple #28
0
 void Awake()
 {
     move = GetComponent <Move>();
     seek = GetComponent <SteeringSeek>();
 }