当前位置: 首页>>代码示例>>C#>>正文


C# SkinnedMeshRenderer.SetBlendShapeWeight方法代码示例

本文整理汇总了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;
    }
开发者ID:marcsolanadal,项目名称:maze-wars,代码行数:30,代码来源:Chest_Controller.cs

示例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);
        }
    }
开发者ID:remistorms,项目名称:VR_Game_01,代码行数:19,代码来源:WallSwitch.cs

示例3: SetValue

 public void SetValue(float _value, SkinnedMeshRenderer smr)
 {
     value = _value;
     smr.SetBlendShapeWeight (index, value);
 }
开发者ID:IJkeB,项目名称:Ekster_Final,代码行数:5,代码来源:Shapeable.cs

示例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);
    }
开发者ID:sideshowdave7,项目名称:jellybeanshape,代码行数:11,代码来源:ShapeBehavior.cs


注:本文中的UnityEngine.SkinnedMeshRenderer.SetBlendShapeWeight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。