Beispiel #1
0
        public static PSR mixIdentity(PSR a, float t)
        {
            PSR psr = new PSR();

            psr.position = a.position * (1f - t);
            psr.scale    = a.scale * (1f - t);
            psr.rotation = Quaternion.Slerp(a.rotation, Quaternion.identity, t);

            return(psr);
        }
Beispiel #2
0
        public static PSR mix(PSR a, PSR b, float t)
        {
            PSR psr = new PSR();

            psr.position = Vector3.Lerp(a.position, b.position, t);
            psr.scale    = Vector3.Lerp(a.scale, b.scale, t);
            psr.rotation = Quaternion.Slerp(a.rotation, b.rotation, t);

            return(psr);
        }
Beispiel #3
0
        public static PSR from(Transform tr, bool global = true)
        {
            PSR psr = new PSR();

            psr.position = global ? tr.position : tr.localPosition;
            psr.scale    = global ? tr.lossyScale : tr.localScale;
            psr.rotation = global ? tr.rotation : tr.localRotation;

            return(psr);
        }
    // Update is called once per frame
    void Update()
    {
        if (main.wheel.standard)
        {
            #region "Wheels"
            set_wheel(RR, RR_wheel, m_rr, false, false);
            set_wheel(RL, RL_wheel, m_rl, true, false);
            set_wheel(FR, FR_wheel, m_fr, false, true);
            set_wheel(FL, FL_wheel, m_fl, true, true);
            #endregion
        }
        else
        {
            set_mid_wheels();
        }

        PSL.Emit((int)(4.2f * m.slip)); PSR.Emit((int)(4.2f * m.slip));
    }
Beispiel #5
0
    void UpdateClones()
    {
        if (lastSourceMode != sourceMode)
        {
            lastSourceMode    = sourceMode;
            forceUpdateClones = true;
        }

        if (clones.Length == (int)n && !forceUpdateClones)
        {
            return;
        }

        sources.RemoveAll(source => source == null);

        for (int i = transform.childCount - 1; i >= 0; i--)
        {
            DestroyImmediate(transform.GetChild(i).gameObject);
        }

        sourcesPSR.Clear();
        foreach (var source in sources)
        {
            sourcesPSR.Add(PSR.from(source));
        }

        clones          = new GameObject[(int)n];
        clonesSourceRef = new GameObject[(int)n];

        for (int i = 0; i < n; i++)
        {
            GameObject source = GetSource(i);
            clonesSourceRef [i] = source;
            clones [i]          = Instantiate(source);
            clones [i].transform.SetParent(transform);
        }

        forceUpdateClones = false;
    }
Beispiel #6
0
 public string RenderInfo()
 {
     return(Name + "(" + PSR.ToString() + ")");
 }
Beispiel #7
0
 virtual public PSR GetPSR(PSR referer, float i)
 {
     return(referer);
 }
Beispiel #8
0
 public static PSR from(GameObject go, bool global = true)
 {
     return(PSR.from(go.transform, global));
 }