private void UpdateBones(ObiActor actor)
 {
     if (m_Bones.Count > 0)
     {
         if (m_Source.solver != null)
         {
             int boneIndex   = 0;
             var constraints = m_Source.softbodyBlueprint.GetConstraintsByType(Oni.ConstraintType.ShapeMatching) as ObiConstraints <ObiShapeMatchingConstraintsBatch>;
             for (int j = 0; j < constraints.GetBatchCount(); ++j)
             {
                 var batch = constraints.GetBatch(j) as ObiShapeMatchingConstraintsBatch;
                 for (int i = 0; i < batch.activeConstraintCount; ++i, ++boneIndex)
                 {
                     // the first particle index in each shape is the "center" particle.
                     int shapeIndex = batch.particleIndices[batch.firstIndex[i]];
                     m_Bones[boneIndex].position = m_Source.GetParticlePosition(m_Source.solverIndices[shapeIndex]);
                     m_Bones[boneIndex].rotation = m_Source.GetParticleOrientation(m_Source.solverIndices[shapeIndex]);
                 }
             }
         }
     }
     else
     {
         CreateBones();
     }
 }
Esempio n. 2
0
 public override void UpdateParticleEditorInformation()
 {
     for (int i = 0; i < body.positions.Length; i++)
     {
         wsPositions[i]    = body.GetParticlePosition(i);
         wsOrientations[i] = body.GetParticleOrientation(i);
         facingCamera[i]   = true;
     }
 }