本文整理汇总了C#中Transform.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# Transform.AddChild方法的具体用法?C# Transform.AddChild怎么用?C# Transform.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform.AddChild方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneTransformTree
public static Transform CloneTransformTree(Animator parser, Transform frame, Transform parent)
{
Transform trans = new Transform(parser.file);
GameObject gameObj = new GameObject(parser.file);
gameObj.m_Name = (string)frame.m_GameObject.instance.m_Name.Clone();
UniqueName(parser, gameObj);
gameObj.AddLinkedComponent(trans);
parser.m_Avatar.instance.AddBone(parent, trans);
trans.m_LocalRotation = frame.m_LocalRotation;
trans.m_LocalPosition = frame.m_LocalPosition;
trans.m_LocalScale = frame.m_LocalScale;
CopyUnknowns(frame, trans);
trans.InitChildren(frame.Count);
for (int i = 0; i < frame.Count; i++)
{
trans.AddChild(CloneTransformTree(parser, frame[i], trans));
}
return trans;
}
示例2: CreateTransformTree
public static Transform CreateTransformTree(Animator parser, ImportedFrame frame, Transform parent)
{
Transform trans = new Transform(parser.file);
GameObject gameObj = new GameObject(parser.file);
gameObj.m_Name = (string)frame.Name.Clone();
UniqueName(parser, gameObj);
gameObj.AddLinkedComponent(trans);
parser.m_Avatar.instance.AddBone(parent, trans);
Vector3 t, s;
Quaternion r;
frame.Matrix.Decompose(out s, out r, out t);
t.X *= -1;
Vector3 euler = FbxUtility.QuaternionToEuler(r);
euler.Y *= -1;
euler.Z *= -1;
trans.m_LocalRotation = FbxUtility.EulerToQuaternion(euler);
trans.m_LocalPosition = t;
trans.m_LocalScale = s;
trans.InitChildren(frame.Count);
for (int i = 0; i < frame.Count; i++)
{
trans.AddChild(CreateTransformTree(parser, frame[i], trans));
}
return trans;
}
示例3: MergeFrame
public void MergeFrame(Transform srcFrame, int destParentId)
{
Transform srcParent = new Transform(srcFrame.file);
GameObject srcGameObj = new GameObject(srcFrame.file);
srcGameObj.AddLinkedComponent(srcParent);
srcParent.InitChildren(1);
srcParent.AddChild(srcFrame);
Transform destParent;
if (destParentId < 0)
{
destParent = new Transform(srcFrame.file);
GameObject destGameObj = new GameObject(srcFrame.file);
destGameObj.AddLinkedComponent(destParent);
destParent.InitChildren(1);
destParent.AddChild(Parser.RootTransform);
Parser.m_GameObject.instance.RemoveLinkedComponent(Parser);
}
else
{
destParent = Frames[destParentId];
}
MergeFrame(srcParent, destParent);
if (destParentId < 0)
{
//Parser.RootTransform = srcParent[0];
srcParent[0].m_GameObject.instance.AddLinkedComponent(Parser);
srcParent.RemoveChild(0);
destParent.m_GameObject.instance.RemoveLinkedComponent(destParent);
srcFrame.file.RemoveSubfile(destParent.m_GameObject.instance);
srcFrame.file.RemoveSubfile(destParent);
}
srcGameObj.RemoveLinkedComponent(srcParent);
srcFrame.file.RemoveSubfile(srcGameObj);
srcFrame.file.RemoveSubfile(srcParent);
if (Parser.file.Bundle != null)
{
Parser.file.Bundle.RegisterForUpdate(Parser.m_GameObject.asset);
}
InitLists();
Changed = true;
}