public SoftBodySettings(SoftBodySettings _settings)
        {
            m_neighbourDistance   = _settings.m_neighbourDistance;
            m_capSpringForce      = _settings.m_capSpringForce;
            m_springCoefficient   = _settings.m_springCoefficient;
            m_dragCoefficient     = _settings.m_dragCoefficient;
            m_pressureCoefficient = _settings.m_pressureCoefficient;

            m_usePressure = _settings.m_usePressure;

            m_fixedDirection = _settings.m_fixedDirection;
            m_fixedOffset    = _settings.m_fixedOffset;

            m_initialiseOnStart = _settings.m_initialiseOnStart;
            m_useMeshInstance   = _settings.m_useMeshInstance;

            m_useInternals   = _settings.m_useInternals;
            m_internalOffset = _settings.m_internalOffset;

            m_useCollisions = _settings.m_useCollisions;

            m_useSelfCollisions             = _settings.m_useSelfCollisions;
            m_selfCollisionRadius           = _settings.m_selfCollisionRadius;
            m_selfCollisionForceCoefficient = _settings.m_selfCollisionForceCoefficient;

            m_useSphereCollisions = _settings.m_useSphereCollisions;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Sets target MeshFilter and generates Mesh Instance
        /// </summary>
        /// <param name="_meshFilter"></param>
        public void Initialise(MeshFilter _meshFilter = null, SoftBodySettings _settings = null)
        {
            if (_meshFilter)
            {
                m_meshFilter = _meshFilter;
            }
            else if (m_meshFilter == null)
            {
                m_meshFilter = GetComponent <MeshFilter>();
            }

            if (_settings != null)
            {
                m_settings = new SoftBodySettings(_settings);
            }
            else if (m_settings == null)
            {
                m_settings = new SoftBodySettings();
            }

            if (m_settings.m_useMeshInstance && m_meshFilter)
            {
                m_meshFilter.sharedMesh = Instantiate(m_meshFilter.sharedMesh);
            }

            m_initialised = m_meshFilter.sharedMesh != null;
        }
Ejemplo n.º 3
0
        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);
        }