本文整理汇总了C#中UnityEngine.SkinnedMeshRenderer类的典型用法代码示例。如果您正苦于以下问题:C# SkinnedMeshRenderer类的具体用法?C# SkinnedMeshRenderer怎么用?C# SkinnedMeshRenderer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SkinnedMeshRenderer类属于UnityEngine命名空间,在下文中一共展示了SkinnedMeshRenderer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: buildMech
void buildMech(Mech m) {
string[] parts = new string[9]{ m.Core, m.Arms, m.Legs, m.Head, m.Booster, m.Weapon1L, m.Weapon1R, m.Weapon2L, m.Weapon2R };
// Create new array to store skinned mesh renderers
SkinnedMeshRenderer[] newSMR = new SkinnedMeshRenderer[5];
Material[] materials = new Material[5];
for (int i = 0; i < 5; i++) {
// Load mech part
GameObject part = Resources.Load (parts [i], typeof(GameObject)) as GameObject;
// Extract Skinned Mesh
newSMR [i] = part.GetComponentInChildren<SkinnedMeshRenderer> () as SkinnedMeshRenderer;
// Load texture
materials [i] = Resources.Load (parts [i] + "mat", typeof(Material)) as Material;
}
// Replace all
SkinnedMeshRenderer[] curSMR = GetComponentsInChildren<SkinnedMeshRenderer> ();
for (int i = 0; i < curSMR.Length; i++){
curSMR[i].sharedMesh = newSMR[i].sharedMesh;
curSMR[i].material = materials[i];
curSMR[i].enabled = true;
}
// Make weapons
buildWeapons (new string[4]{parts[5],parts[6],parts[7],parts[8]});
}
开发者ID:andysctu,项目名称:SteelX,代码行数:29,代码来源:BuildLobbyMech.cs
示例17: Start
void Start()
{
skinnedMeshRend = GetComponent<SkinnedMeshRenderer>();
clothMesh = GetComponent<SkinnedMeshRenderer>().sharedMesh;
shapeCount = clothMesh.blendShapeCount;
skinnedMeshRend.updateWhenOffscreen = false;
}
开发者ID:yhern006,项目名称:3D_Pacman,代码行数:7,代码来源:ClothMovement.cs
示例18: Awake
void Awake()
{
filter = GetComponent<MeshFilter>();
skinnedMeshRenderer = GetComponent<SkinnedMeshRenderer>();
if(filter==null && skinnedMeshRenderer == null)
Destroy(this);
}
开发者ID:rlawther,项目名称:AmnesiaMuseumUnity,代码行数:7,代码来源:StoreMesh.cs
示例19: CreateControlPoints
public static void CreateControlPoints(SkinnedMeshRenderer skin) {
if (skin.sharedMesh != null)
{
for (int i = 0; i < skin.sharedMesh.vertices.Length; i++)
{
GameObject b = new GameObject("Control Point");
// Unparent the skin temporarily before adding the control point
Transform skinParent = skin.transform.parent;
skin.transform.parent = null;
// Reset the rotation before creating the mesh so the UV's will align properly
Quaternion localRotation = skin.transform.localRotation;
skin.transform.localRotation = Quaternion.identity;
b.transform.position = new Vector3(skin.transform.position.x + (skin.sharedMesh.vertices[i].x * skin.transform.localScale.x), skin.transform.position.y + (skin.sharedMesh.vertices[i].y * skin.transform.localScale.y), skin.transform.position.z + (skin.sharedMesh.vertices[i].z * skin.transform.localScale.z));
b.transform.parent = skin.transform;
ControlPoint[] points = b.transform.parent.transform.GetComponentsInChildren<ControlPoint>();
if (points != null && points.Length > 0)
{
b.gameObject.name = b.gameObject.name + points.Length;
}
Undo.RegisterCreatedObjectUndo(b, "Add control point");
ControlPoint controlPoint = b.AddComponent<ControlPoint>();
controlPoint.index = i;
controlPoint.skin = skin;
controlPoint.originalPosition = b.transform.localPosition;
// Reset the rotations of the object
skin.transform.localRotation = localRotation;
skin.transform.parent = skinParent;
}
}
}
开发者ID:CenzyGames,项目名称:Save-your-date-new,代码行数:33,代码来源:ControlPoint.cs
示例20: Start
private void Start()
{
this.pVis = base.transform.root.GetComponent<netPlayerVis>();
this.tr = base.transform;
this.skin = base.transform.GetComponent<SkinnedMeshRenderer>();
this.setup = base.transform.root.GetComponentInChildren<playerScriptSetup>();
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:7,代码来源:playerMeshSwitcher.cs
注:本文中的UnityEngine.SkinnedMeshRenderer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论