本文整理汇总了C#中UnityEngine.SkinnedMeshRenderer.SetBlendShapeWeight方法的典型用法代码示例。如果您正苦于以下问题:C# SkinnedMeshRenderer.SetBlendShapeWeight方法的具体用法?C# SkinnedMeshRenderer.SetBlendShapeWeight怎么用?C# SkinnedMeshRenderer.SetBlendShapeWeight使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.SkinnedMeshRenderer
的用法示例。
在下文中一共展示了SkinnedMeshRenderer.SetBlendShapeWeight方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBlendMesh
// TODO: Put this into Misc class?
private void CreateBlendMesh(SkinnedMeshRenderer skinnedMeshRenderer, Mesh skinnedMesh, string name, bool convex)
{
// Detecting how many BlendShapes we have.
int blendShapeCount = 0;
blendShapeCount = skinnedMesh.blendShapeCount;
Debug.Log("BlendShape count bottom: " + blendShapeCount);
// Applying BlendShapes.
if (blendShapeCount != 0)
skinnedMeshRenderer.SetBlendShapeWeight(0, size * 100);
// Creates a snapshot of the SkinnedMeshRenderer and stores it in the mesh.
// That skinned mesh renderer should have the shape with the BlendShapes applyied.
Mesh bakedMesh = new Mesh();
skinnedMeshRenderer.BakeMesh(bakedMesh);
// Recalcultate the bounding volume of the mesh from the vertices.
bakedMesh.RecalculateBounds();
Debug.Log("Baked mesh bounds: " + bakedMesh.bounds.ToString());
// Selecting part and destroying MeshCollider in case there is one.
GameObject child = transform.FindChild(name).gameObject;
DestroyImmediate(child.GetComponent<MeshCollider>());
// Adding MeshCollider and assigning the bakedMesh.
MeshCollider meshCollider = child.AddComponent<MeshCollider>();
meshCollider.sharedMesh = bakedMesh;
meshCollider.convex = convex;
}
示例2: Start
// Use this for initialization
void Start()
{
mySwitchMesh = GetComponent<SkinnedMeshRenderer>();
myMaterial = mySwitchMesh.material;
myAudioSource = GetComponent<AudioSource>();
if (state == true)
{
myMaterial.color = Color.green;
mySwitchMesh.SetBlendShapeWeight(0, 100);
}
if (state == false)
{
myMaterial.color = Color.red;
mySwitchMesh.SetBlendShapeWeight(0, 0);
}
}
示例3: SetValue
public void SetValue(float _value, SkinnedMeshRenderer smr)
{
value = _value;
smr.SetBlendShapeWeight (index, value);
}
示例4: Start
// Use this for initialization
void Start()
{
_meshRenderer = this.GetComponent<SkinnedMeshRenderer>();
if(_shapeType != ShapeType.Circle)
{
_meshRenderer.SetBlendShapeWeight(ShapeToInt(_shapeType),100);
}
this.gameObject.GetComponent<ColorBehavior>().Set_Color(_shapeType);
}