Пример #1
0
        void OnWizardUpdate()
        {
            if (BoneSettingName == null)
            {
                BoneSettingName = new string[boneObjects.Length];
                for (int i = 0; i < boneObjects.Length; i++)
                {
                    SpringBoneSetting setting = (SpringBoneSetting)boneObjects[i];

                    if (setting.m_comment == "")
                    {
                        foreach (string name in setting.RootBones)
                        {
                            BoneSettingName[i] = "右のボーンを含む→" + name;
                            break;
                        }
                    }
                    else
                    {
                        BoneSettingName[i] = setting.m_comment;
                    }
                }
            }
            if (ColliderSettingName == null)
            {
                ColliderSettingName = new string[colliderObjects.Length];
                for (int i = 0; i < colliderObjects.Length; i++)
                {
                    SpringBoneColliderSetting setting
                        = (SpringBoneColliderSetting)colliderObjects[i];
                    ColliderSettingName[i] = setting.TargetName;
                }
            }
        }
Пример #2
0
        void ExportSpringBoneCollider()
        {
            //gizmo以外はエクスポート
            for (int j = 0; j < ColliderTergetName.Count; j++)
            {
                GameObject colliderObject          = GameObject.Find(ColliderTergetName[j]);
                SpringBoneColliderGroup   collider = colliderObject.GetComponent <SpringBoneColliderGroup>();
                SpringBoneColliderSetting exportData
                    = ScriptableObject.CreateInstance <SpringBoneColliderSetting>();
                exportData.TargetName = m_Utility.GetHierarchyPath(colliderObject.transform);
                exportData.Colliders  = new SpringBoneColliderSetting.SphereCollider[collider.Colliders.Length];
                for (int i = 0; i < collider.Colliders.Length; i++)
                {
                    exportData.Colliders[i]        = new SpringBoneColliderSetting.SphereCollider();
                    exportData.Colliders[i].Radius = collider.Colliders[i].Radius;
                    exportData.Colliders[i].Offset = collider.Colliders[i].Offset;
                }

                AssetDatabase.CreateAsset(
                    exportData, "Assets/Models/Resources/SpringBoneData/Collider/SpringBoneColliderData_" + j + ".asset");
            }
        }
Пример #3
0
        void ApplySpringBoneCollider()
        {
            //gizmo以外は設定を反映する
            for (int j = 0; j < colliderObjects.Length; j++)
            {
                SpringBoneColliderSetting settingData = (SpringBoneColliderSetting)colliderObjects[j];

                //対象のボーン
                //m_Utility.ChangeRootPath 設定されたパスをターゲット対象に変更する
                GameObject targetObject
                    = GameObject.Find(m_Utility.ChangeRootPath(settingData.TargetName, targetModel.name));

                SpringBoneColliderGroup collider = targetObject.AddComponent <SpringBoneColliderGroup>();

                collider.Colliders = new SpringBoneColliderGroup.SphereCollider[settingData.Colliders.Length];
                for (int i = 0; i < settingData.Colliders.Length; i++)
                {
                    collider.Colliders[i]        = new SpringBoneColliderGroup.SphereCollider();
                    collider.Colliders[i].Radius = settingData.Colliders[i].Radius;
                    collider.Colliders[i].Offset = settingData.Colliders[i].Offset;
                }
            }
        }