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


C# UnityEngine.SkinnedMeshRenderer类代码示例

本文整理汇总了C#中UnityEngine.SkinnedMeshRenderer的典型用法代码示例。如果您正苦于以下问题:C# SkinnedMeshRenderer类的具体用法?C# SkinnedMeshRenderer怎么用?C# SkinnedMeshRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SkinnedMeshRenderer类属于UnityEngine命名空间,在下文中一共展示了SkinnedMeshRenderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

 // Use this for initialization
 void Start()
 {
     timer = 0f;
     timeToUpdate = 1 / updatesPerSecond;
     particleSystem = GetComponent<ParticleSystem> ();
     skin = objectToPutParticlesOn.GetComponent<SkinnedMeshRenderer>();
 }
开发者ID:JosepFloriach,项目名称:LightguardLegacy,代码行数:8,代码来源:ParticleReposition.cs

示例2: OnGUI

    public void OnGUI() {
        skin = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Skin", skin, typeof(SkinnedMeshRenderer), true);

        if (skin != null) {
            GUI.color = (isPainting) ? Color.green : Color.white;

            if (GUILayout.Button("Paint")) {
                isPainting = !isPainting;
                if (isPainting) {
                    Selection.objects = new GameObject[] { skin.gameObject };
                }
                SceneView.currentDrawingSceneView.Repaint();
            }

            GUI.color = Color.white;

            brushSize = EditorGUILayout.FloatField("Brush size", brushSize * 2) / 2;
            weight = Mathf.Clamp(EditorGUILayout.FloatField("Weight", weight), 0, 1);
            mode = (PaintingMode)EditorGUILayout.EnumPopup("Mode", mode);

            string[] bones = skin.bones.Select(b => b.gameObject.name).ToArray();
            bone = EditorGUILayout.Popup("Bone", bone, bones);

        }
    }
开发者ID:iamjianxin,项目名称:UnitySpritesAndBones,代码行数:25,代码来源:Weightpainter.cs

示例3: SetBaseMesh

		private void SetBaseMesh(string assetPath)
		{
			var curDir = System.IO.Directory.GetCurrentDirectory().Replace('\\', '/');
			if (assetPath.StartsWith(curDir, System.StringComparison.InvariantCultureIgnoreCase))
			{
				assetPath = assetPath.Remove(0, curDir.Length + 1);
			}
			var asset = AssetDatabase.LoadMainAssetAtPath(assetPath);
			if (asset is GameObject)
			{
				RaceGO = Instantiate(asset) as GameObject;
				RaceSMR = RaceGO.GetComponentInChildren<SkinnedMeshRenderer>();
				if (RaceSMR != null)
				{
					if (SlotSMR != null)
					{
						PerformValidation();
					}
					else
					{
						NextPage();
					}
				}
				else
				{
					Destroy(RaceGO);
				}
			}
		}
开发者ID:NotYours180,项目名称:UMA,代码行数:29,代码来源:UMASlotVerifyWizard.cs

示例4: Start

 // Use this for initialization
 void Start()
 {
     if (gameObject.layer == 8) {
         rend = transform.GetChild (0).transform.GetChild (1).GetComponent<SkinnedMeshRenderer> ();
     }
     flag = true;
 }
开发者ID:MangoSister,项目名称:PunkRising,代码行数:8,代码来源:HealthManager.cs

示例5: Refresh

    public void Refresh()
    {
        if(transform.parent)
            if(transform.parent.GetComponent<SkinnedMeshRenderer>())
                meshRenderer = transform.parent.GetComponent<SkinnedMeshRenderer>();
	        BoneWeight[] boneWeights = mesh.boneWeights;

        if(Bone0)
            boneWeights[vertNumber].boneIndex0 = boneIndex0;
        if(Bone1)
            boneWeights[vertNumber].boneIndex1 = boneIndex1;
        if(Bone2)
            boneWeights[vertNumber].boneIndex2 = boneIndex2;
        if(Bone3)
            boneWeights[vertNumber].boneIndex3 = boneIndex3;

        boneWeights[vertNumber].weight0 = Weight0;
        boneWeights[vertNumber].weight1 = Weight1;
        boneWeights[vertNumber].weight2 = Weight2;
        boneWeights[vertNumber].weight3 = Weight3;

        mesh.boneWeights = boneWeights;
        if(meshRenderer != null)
            meshRenderer.sharedMesh = mesh;
    }
开发者ID:XvWenJun,项目名称:Retuer_6,代码行数:25,代码来源:Puppet2D_EditSkinWeights.cs

示例6: OnStateEnter

    //    private AnotherScript anotherScript;
    //private GameObject otherScript;
    //OtherScript = GetComponent(OtherScript);
    //public GameObject objectToAccess;
    // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
    public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        cartucho = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/cartucho_006");
        m =cartucho.GetComponent<SkinnedMeshRenderer>();

        m.enabled = false;
        //Instantiate(flash,);
        casquillos = animator.GetInteger ("casquillos");

        //GameObject Object1 = GameObject.Find ("armas");
        //Component anotherScript = Object1.GetComponent<disparosDelJugador> ();
        disparo = GameObject.Find ("armas").GetComponent<disparosDelJugador> ();
        disparo.disparo (3);
        anim = GameObject.Find ("animacionColt44-40").GetComponent<Animator> ();

        anim.SetInteger ("cartuchos",anim.GetInteger("cartuchos")-1);
        //Transform bone = GetComponent<Animator>().avatar.GetBone(BoneType.LeftShoulder);

        objetin = GameObject.FindGameObjectsWithTag ("canionColt");
        posicionHueso = objetin [0].transform;
        Debug.Log("Posicion del hgueso -----------------"+posicionHueso.position+"----------------------");

        Instantiate (esfera, posicionHueso.position,posicionHueso.rotation);
        //		Script1.disparo ();
        /*abtenemos posicion del
        posicion = GameObject.Find ("/FPSController/FirstPersonCharacter/armas/animacionColt44-40/marco").GetComponent<Transform>();
        Debug.Log ("+++++++++++ la poscion del flash es:   " + posicion.position + "+++++++++++++++++++");canion*/

        /*obtenemos un hueso*/
    }
开发者ID:JonaSilva,项目名称:prueba,代码行数:35,代码来源:disparoColt44.cs

示例7: OnEnter

        public override void OnEnter()
        {
            GameObject go =	gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;
            if (go!=null)
            {
                _skr = go.GetComponent<SkinnedMeshRenderer>();
            }

            if (_skr == null)
            {
                LogWarning("Missing component SkinnedMeshRenderer");
                Finish();
                return;
            }

            if (! orBlendShapeName.IsNone)
            {
                _blendShapeIndex = _skr.sharedMesh.GetBlendShapeIndex(orBlendShapeName.Value);
            }else{
                _blendShapeIndex = blendShapeIndex.Value;
            }

            DoGetBlendShapeWeight();

            if (!everyFrame)
            {
                Finish();
            }
        }
开发者ID:ETGgames,项目名称:PlayMakerCustomActions_U4,代码行数:29,代码来源:GetBlendShapeWeight.cs

示例8: Start

    // Use this for initialization
    void Start () {
        //voxelPool = mng.poolManager.voxelPool;
        voxelScriptPool = mng.poolManager.voxelControllerPool;
        voxelColliderPool = mng.poolManager.voxelColliderPool;

        mat = redMaterial;

        if (!includeChildren)
        {
            transf = gameObject.transform;
            rend = gameObject.GetComponent<Renderer>();
            meshFilter = gameObject.GetComponent<MeshFilter>();
            sRend = gameObject.GetComponent<SkinnedMeshRenderer>();
        }
        else
        {
            transforms = new List<Transform>();
            renderers = new List<Renderer>();
            isSkinedMeshRenderer = new List<bool>();
            meshFilters = new List<MeshFilter>();
            meshes = new List<Mesh>();

            PopulateLists(gameObject);
        }

        voxelScale = new Vector3(voxelSideSize, voxelSideSize, voxelSideSize);
    }
开发者ID:ChromaTeamUPC,项目名称:ChromaVirus,代码行数:28,代码来源:VoxelizationClient.cs

示例9: Awake

	// Use this for initialization
	void Awake () 
	{
		player = GameObject.FindGameObjectWithTag ("Player");
		lightVisibilityCheck = GameObject.Find ("LightVisibilityChecker").transform;
		pointLight = GetComponent<Light> ();
		_renderer = GameObject.Find("vincent_Casual_Male_Lod_1").GetComponent<SkinnedMeshRenderer> ();
	}
开发者ID:shaunus84,项目名称:through-shadows,代码行数:8,代码来源:PlayerDetector.cs

示例10: OnGUI

    public void OnGUI() {
        skin = (SkinnedMeshRenderer)EditorGUILayout.ObjectField("Skin", skin, typeof(SkinnedMeshRenderer), true);

        if (skin != null && skin.bones.Length > 0) {
            GUI.color = (isPainting) ? Color.green : Color.white;

            if (GUILayout.Button("Paint")) {
                isPainting = !isPainting;
                if (isPainting) {
                    Selection.objects = new GameObject[] { skin.gameObject };
                }
                SceneView.currentDrawingSceneView.Repaint();
            }

            GUI.color = Color.white;

            brushSize = EditorGUILayout.FloatField("Brush size", brushSize * 2) / 2;
            weight = Mathf.Clamp(EditorGUILayout.FloatField("Weight", weight), 0, 1);
            mode = (PaintingMode)EditorGUILayout.EnumPopup("Mode", mode);

            string[] bones = skin.bones.Select(b => b.gameObject.name).ToArray();
			boneIndex = EditorGUILayout.Popup("Bone", boneIndex, bones);
            colorTransparency = Mathf.Clamp(EditorGUILayout.FloatField("Color Transparency", colorTransparency), 0, 1);

        } else {
			EditorGUILayout.HelpBox("SkinnedMeshRenderer not assigned to any bones, Recalculate Bone Weights.", MessageType.Error);
			if (SceneView.currentDrawingSceneView != null)
				SceneView.currentDrawingSceneView.Repaint();
		}
    }
开发者ID:MJ-meo-dmt,项目名称:UnitySpritesAndBones,代码行数:30,代码来源:Weightpainter.cs

示例11: Start

	// Use this for initialization
	void Start () {
		GameObject face = Instantiate(Face) as GameObject;
		face.transform.parent = transform;
		FaceRenderer = face.GetComponentInChildren<SkinnedMeshRenderer>();

		GameObject body = Instantiate(Body) as GameObject;
		body.transform.parent = transform;
		BodyRenderer = body.GetComponentInChildren<SkinnedMeshRenderer>();
		
		CombinedRenderer = gameObject.GetComponent<SkinnedMeshRenderer>();
		// 重组Mesh后删除原始GO
		Mesh faceMesh = FaceRenderer.sharedMesh;
		Mesh bodyMesh = BodyRenderer.sharedMesh;

		CombineInstance[] combineInstances = new CombineInstance[2];
		combineInstances[0].mesh = faceMesh;
		combineInstances[0].transform = FaceRenderer.transform.localToWorldMatrix;
		combineInstances[1].mesh = bodyMesh;
		combineInstances[1].transform = BodyRenderer.transform.localToWorldMatrix;

		CombinedRenderer.sharedMesh = new Mesh();
		CombinedRenderer.sharedMesh.CombineMeshes(combineInstances);
		
		// 组合材质球引用
		Material[] sharedMats = new Material[2];
		sharedMats[0] = FaceRenderer.sharedMaterial;
		sharedMats[1] = BodyRenderer.sharedMaterial;
		CombinedRenderer.sharedMaterials = sharedMats;

		// Mesh和材质的关联是按照材质在数组中的顺序的,重组Mesh势必会产生一个新的材质球次序
	}
开发者ID:Henry-T,项目名称:UnityPG,代码行数:32,代码来源:CombineMeshByCode.cs

示例12: Awake

 protected virtual void Awake()
 {
     creatureActions = GetComponent<CreatureActions>();
     animator = GetComponentInChildren<Animator>();
     particleSystem = GetComponentInChildren<ParticleSystem>();
     meshRenderer = GetComponentInChildren<SkinnedMeshRenderer>();
 }
开发者ID:diego-ruiz,项目名称:gamejam16,代码行数:7,代码来源:Creature.cs

示例13: OnGUI

    private void OnGUI()
    {
        EditorGUI.BeginChangeCheck();
        skinnedMeshRenderer =
            (SkinnedMeshRenderer) EditorGUILayout.ObjectField(skinnedMeshRenderer, typeof (SkinnedMeshRenderer), true);
        EditorGUI.EndChangeCheck();

        if (skinnedMeshRenderer != null)
        {
            var mesh = skinnedMeshRenderer.sharedMesh;

            var sb = new StringBuilder();
            sb.AppendLine("public enum BlendShapes : int");
            sb.AppendLine("{");
            sb.AppendLine(string.Format("\t{0} = {1},", "Unknown", -1));
            sb.AppendLine();
            for (var i = 0; i < mesh.blendShapeCount; i++)
                sb.AppendLine(string.Format("\t{0} = {1},", mesh.GetBlendShapeName(i).Replace('.', '_'), i));
            sb.AppendLine();
            sb.AppendLine(string.Format("\t{0} = {1}", "LastBlendShape", mesh.blendShapeCount));
            sb.AppendLine("}");

            scroll = EditorGUILayout.BeginScrollView(scroll);
            EditorGUILayout.TextArea(sb.ToString());
            EditorGUILayout.EndScrollView();
        }
    }
开发者ID:Zerseu,项目名称:Reflecta,代码行数:27,代码来源:EditorWindowBlendShapes.cs

示例14: 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

示例15: Initialize

    virtual public void Initialize(Ilife lifeData, string resourcePath, AssetType resourceType)
    {
        m_LifeData = lifeData;
        m_iInstanceId = lifeData.GetInstanceId();

        m_ObjectInstance = GameObject.Instantiate(ResourceManager.Instance.LoadBuildInResource<GameObject>(resourcePath, resourceType));

        //load material
        string localpath = resourcePath.Substring(0, resourcePath.LastIndexOf('/'));
        m_NormalMaterial = ResourceManager.Instance.LoadBuildInResource<Material>(localpath + "/Normal", AssetType.Char);
        m_HighlightMaterial = ResourceManager.Instance.LoadBuildInResource<Material>(localpath + "/SelectedHighlight", AssetType.Char);
        m_MeshRender = ComponentTool.FindChildComponent<SkinnedMeshRenderer>("Body", m_ObjectInstance);
        if (null == m_NormalMaterial || null == m_HighlightMaterial || null == m_MeshRender)
        {
            Debuger.LogWarning("can't load mesh render or normal&highlight materials !");
        }

        //mark transform
        m_CharContainer = m_ObjectInstance.AddComponent<CharTransformContainer>();
        m_CharContainer.Initialize(lifeData.GetInstanceId(), lifeData);

        if (null == m_ObjectInstance)
        {
            Debuger.LogError("Can't load resource " + resourcePath);
        }
        m_AnimatorAgent = new AnimatorAgent(m_ObjectInstance);
    }
开发者ID:Blizzardx,项目名称:ClientFrameWork,代码行数:27,代码来源:CharTransformData.cs


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