Ejemplo n.º 1
0
    /// <summary>
    /// Function called before of the first update
    /// </summary>
    void Start()
    {
        droneMovementController dmc = gameObject.GetComponent <droneMovementController>();

        // associate the rotors
        helixO1 = dmc.helixO1;
        helixO2 = dmc.helixO2;
        helixV1 = dmc.helixV1;
        helixV2 = dmc.helixV2;

        // finds the rotors position
        Vector3 v1 = helixV1.transform.position;
        Vector3 v2 = helixV2.transform.position;
        Vector3 o1 = helixO1.transform.position;
        Vector3 o2 = helixO2.transform.position;

        Vector3 mid_v1o1 = (v1 + o1) / 2f;
        Vector3 mid_v2o2 = (o2 + v2) / 2f;

        distanceBetweenHelixes = Vector3.Distance(mid_v1o1, mid_v2o2);

        // instantiates the noiseAdders, to add the noise to the measurement
        nRoll       = new noiseAdder();
        nRollSpeed  = new noiseAdder();
        nRollAcc    = new noiseAdder();
        nPitch      = new noiseAdder();
        nPitchSpeed = new noiseAdder();
        nPitchAcc   = new noiseAdder();
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     ro  = gameObject.GetComponent <rotor>();
     cam = Camera.main;
     cam.transform.position = transform.position + new Vector3(Random.Range(-10, 10), Random.Range(-10, 10), -10);
     cam.transform.RotateAround(transform.position, Vector3.forward, Random.Range(0, 360));
     cam.transform.rotation = Quaternion.identity;
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     objects_size  = moving_objects.Length;
     player        = GameObject.FindGameObjectWithTag("Player").GetComponent <rotor>();
     objects_speed = new float[objects_size];
     for (int i = 0; i < objects_size; i++)
     {
         objects_speed[i] = moving_objects[i].GetComponent <move_obstacle>().speed;
     }
     orb = gameObject.GetComponent <orbit>();
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Function Called when the object is activated for the first time
    /// </summary>
    void Awake()
    {
        // initializes the noiseAdders
        nYaw   = new noiseAdder();
        nSpeed = new noiseAdder();

        // look for the rotors in the droneMovementController
        droneMovementController dmc = gameObject.GetComponent <droneMovementController>();

        helixO1 = dmc.helixO1;
        helixO2 = dmc.helixO2;
        helixV1 = dmc.helixV1;
        helixV2 = dmc.helixV2;
        lastYaw = yaw = getYawINT();
    }
Ejemplo n.º 5
0
 private void Start()
 {
     rot = gameObject.GetComponent <rotor>();
 }
Ejemplo n.º 6
0
 void Start()
 {
     rot = controller.GetComponent <rotor>();
     pow = this.GetComponent <Text>();
 }
Ejemplo n.º 7
0
 void Start()
 {
     rot  = controller.GetComponent <rotor>();
     slid = this.GetComponent <Slider>();
 }
 /// <summary>
 /// Calculates the amount of torque that a single rotor is generating over the entire system.
 /// <para>The sum of the results of this funcion, applied to the four rotors have to be passed as
 /// parameter to the function <c>applyTorque(float amount)</c></para>
 /// </summary>
 /// <param name="r">Rotor class</param>
 /// <returns>The amount of torque that a single rotor is generating over the entire system</returns>
 float torqueGeneratedBy(rotor r)
 {
     return((r.counterclockwise ? -1 : 1) * denormalizeTorque(r.getPower()) * 10);
 }