public static void MakeObjectSoftbodyChain(GameObject _object, Chain _chain, SoftBodySettings _settings)
        {
            SoftBodyMesh mesh = _object.AddComponent <SoftBodyMesh>();

            mesh.Initialise(_object.GetComponent <MeshFilter>(), _settings);
            mesh.CreateSoftBodyFromChain(_chain);

            SoftBodyCore core = _object.AddComponent <SoftBodyCore>();

            core.Initialise(mesh);
        }
Exemple #2
0
 public Mass(SoftBodyMesh _mesh, Vector3 _postion, Vector3 _normal, int _index, bool _fixed)
 {
     mesh                 = _mesh;
     vertexGroup          = null;
     m_postion            = _postion;
     m_normal             = _normal;
     index                = _index;
     springs              = new List <int>();
     neighbours           = new List <int>();
     structuralNeighbours = new List <int>();
     force                = Vector3.zero;
     velocity             = Vector3.zero;
     m_fixed              = _fixed;
 }
Exemple #3
0
        public void Initialise(SoftBodyMesh _mesh)
        {
            m_softBody    = _mesh;
            m_gpuSoftBody = ComputeShader.Instantiate(Resources.Load <ComputeShader>("GPUSoftBody"));

            GeneralForces.s_instance.m_sphereColliderUpdate += UpdateSphereColliders;
            if (GeneralForces.s_instance.GetSphereColliderCount() > 0)
            {
                UpdateSphereColliders();
            }

            if (m_softBody)
            {
                GenerateGPUData();
                SetupShader();
                m_initialise = true;
            }
            else
            {
                m_initialise = false;
            }
        }