Esempio n. 1
0
 void Awake()
 {
     base.Awake();
     if (entity == null)
     {
         entity = GetComponent <Partix.SoftVolume>();
     }
 }
Esempio n. 2
0
    void Awake()
    {
        world = FindObjectOfType <Partix.World>();
        sv    = GetComponent <Partix.SoftVolume>();

        accel    = Vector3.zero;
        velocity = Vector3.zero;
    }
Esempio n. 3
0
    void Awake()
    {
        softVolume = GetComponent <Partix.SoftVolume>();

        string[] colors = { "Red", "Violet", "Yellow", "White" };
        var      color  = colors[UnityEngine.Random.Range(0, 4)];

        var prefab = string.Format(
            "Poppy/{0}/Poppy_{0}_0{1}", color,
            UnityEngine.Random.Range(0, 9));

        GameObject view =
            GameObject.Instantiate(
                Resources.Load <GameObject>(prefab), transform, false);

        softVolume.meshRenderers =
            view.GetComponentsInChildren <MeshRenderer>();
    }
Esempio n. 4
0
    public static void Fix(
        Partix.SoftVolume sv, float friction, float threshold)
    {
        Vector3[] vertices = sv.GetWireFrameVertices();
        Partix.VehiclePointLoad[] loads = sv.GetPointLoads();

        // boundingbox
        var bb = new BoundingBox(vertices);

        for (int i = 0; i < vertices.Length; i++)
        {
            Vector3 v  = vertices[i];
            Vector3 np = bb.CalculateNormalizedPosition(v);
            loads[i].friction   = 0.2f;
            loads[i].fix_target = np.y < threshold ? 1 : 0;
            // loads[i].fix_target = 0;
        }
        sv.SetPointLoads(loads);
    }
Esempio n. 5
0
 void Awake()
 {
     softVolume = GetComponent <Partix.SoftVolume>();
 }
Esempio n. 6
0
 void Awake()
 {
     entity = GetComponent <Partix.SoftVolume>();
 }