コード例 #1
0
        public override IObiConstraintsBatch Clone()
        {
            var clone = new ObiSkinConstraintsBatch(this);

            clone.particleIndices.ResizeUninitialized(particleIndices.count);
            clone.skinPoints.ResizeUninitialized(skinPoints.count);
            clone.skinNormals.ResizeUninitialized(skinNormals.count);
            clone.skinRadiiBackstop.ResizeUninitialized(skinRadiiBackstop.count);
            clone.skinCompliance.ResizeUninitialized(skinCompliance.count);

            clone.particleIndices.CopyFrom(particleIndices);
            clone.skinPoints.CopyFrom(skinPoints);
            clone.skinNormals.CopyFrom(skinNormals);
            clone.skinRadiiBackstop.CopyFrom(skinRadiiBackstop);
            clone.skinCompliance.CopyFrom(skinCompliance);

            return(clone);
        }
コード例 #2
0
        protected IEnumerator CreateSkinConstraints()
        {
            skinConstraintsData = new ObiSkinConstraintsData();
            ObiSkinConstraintsBatch skinBatch = new ObiSkinConstraintsBatch();

            skinConstraintsData.AddBatch(skinBatch);

            for (int i = 0; i < topology.vertices.Count; ++i)
            {
                skinBatch.AddConstraint(i, Vector3.Scale(scale, topology.vertices[i].position), Vector3.up, 0.05f, 0.1f, 0, 0);
                skinBatch.activeConstraintCount++;

                if (i % 500 == 0)
                {
                    yield return(new CoroutineJob.ProgressInfo("ObiCloth: generating skin constraints...", i / (float)topology.vertices.Count));
                }
            }

            Vector3[] normals = topology.inputMesh.normals;
            for (int i = 0; i < normals.Length; ++i)
            {
                skinBatch.skinNormals[topology.rawToWelded[i]] = normals[i];
            }
        }
コード例 #3
0
 public ObiSkinConstraintsBatch(ObiSkinConstraintsBatch source = null) : base(source)
 {
 }
コード例 #4
0
 public ObiSkinConstraintsBatch(ObiSkinConstraintsData constraints = null, ObiSkinConstraintsBatch source = null) : base(source)
 {
     m_Constraints = constraints;
 }