コード例 #1
0
ファイル: MMIAvatar.cs プロジェクト: dr-iskandar/MOSIM_Core
        // Use this for initialization
        protected override void Start()
        {
            base.Start();

            //Assign the behavior
            this.Behavior = this.GetComponent <AvatarBehavior>();

            //Add root scene object for the avatar
            this.gameObject.AddComponent <MMISceneObject>();

            //Add the scene objects of the bones (if desired)
            if (this.AddBoneSceneObjects)
            {
                //Setup the scene objects of the bones
                foreach (Transform transform in this.Joints)
                {
                    MMISceneObject s = transform.gameObject.AddComponent <MMISceneObject>();
                    s.ShowCoordinateSystem = false;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Sets up the transform of the MSceneObject
        /// </summary>
        private void SetupTransform()
        {
            //Create the transform
            this.MSceneObject.Transform = new MTransform()
            {
                ID       = this.MSceneObject.ID,
                Position = this.transform.position.ToMVector3(),
                Rotation = this.transform.rotation.ToMQuaternion()
            };

            //Set the parent if available
            if (this.transform.parent != null && this.transform.GetComponentsInParent <MMISceneObject>().Length > 1)
            {
                MMISceneObject parent = this.transform.GetComponentsInParent <MMISceneObject>()[1];

                this.MSceneObject.Transform.Parent = parent.name;
            }

            else
            {
                this.MSceneObject.Transform.Parent = null;
            }
        }