コード例 #1
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static void GetDefinitionAndTileMeshes(GameObject go, ref Mesh meshDefinition, out Matrix4x4 m_Definition_MODEL_to_WORLD, ref bool isBakedDefinitionMesh, ref Mesh meshTile)
        {
            Caronte_Fx_Body bodyComponent = go.GetComponent <Caronte_Fx_Body>();

            isBakedDefinitionMesh = bodyComponent.GetRenderMesh(out meshDefinition, out m_Definition_MODEL_to_WORLD);
            meshTile = bodyComponent.GetTileMesh();
        }
コード例 #2
0
    public void GenerateSphereMeshes()
    {
      foreach( var tuple in listClothBodiesGORadius_ )
      {
        GameObject go = tuple.First;

        if ( go == null)
        {
          continue;
        }
        
        float radius  = tuple.Second;

        Caronte_Fx_Body crBody = go.GetComponent<Caronte_Fx_Body>();
        if (crBody != null)
        {
          Mesh mesh = null;
          if ( crBody.IsCustomCollider() )
          {
            mesh = crBody.GetCustomColliderMesh();
          }
          else
          {
            mesh = go.GetMesh();
          }
        
          if (mesh != null)
          {
            AddMeshSpheres( mesh, go.transform.localToWorldMatrix, radius );
          }
        }
      }
    }
コード例 #3
0
        //-----------------------------------------------------------------------------------
        public static void DrawToggleMixedBodyComponents(string toggleString, List <Caronte_Fx_Body> listBodyComponent, float width)
        {
            EditorGUI.BeginChangeCheck();
            int nMonoBehaviours = listBodyComponent.Count;

            EditorGUI.showMixedValue = false;
            bool value = false;

            if (nMonoBehaviours > 0)
            {
                int i;
                for (i = 0; i < nMonoBehaviours; i++)
                {
                    if (listBodyComponent[i] != null)
                    {
                        value = listBodyComponent[i].RenderCollider;
                        break;
                    }
                }

                for (i = i + 1; i < nMonoBehaviours; i++)
                {
                    Caronte_Fx_Body mbh = listBodyComponent[i];
                    if (mbh != null && value != mbh.RenderCollider)
                    {
                        EditorGUI.showMixedValue = true;
                        break;
                    }
                }
            }
            EditorGUI.BeginDisabledGroup(nMonoBehaviours == 0);
#if UNITY_PRO_LICENSE
            value = EditorGUILayout.ToggleLeft(toggleString, value, GUILayout.MaxWidth(width));
#else
            value = GUILayout.Toggle(value, toggleString, GUILayout.MaxWidth(width));
#endif
            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                int  undoGroupIdx = Undo.GetCurrentGroup();
                bool wasSomeUndo  = false;
                for (int i = 0; i < nMonoBehaviours; i++)
                {
                    Caronte_Fx_Body cfxBody = listBodyComponent[i];
                    if (cfxBody != null)
                    {
                        Undo.RecordObject(cfxBody, "CaronteFX - Change " + toggleString);
                        cfxBody.RenderCollider = value;
                        EditorUtility.SetDirty(cfxBody);
                        wasSomeUndo = true;
                    }
                }

                if (wasSomeUndo)
                {
                    Undo.CollapseUndoOperations(undoGroupIdx);
                }
            }
            EditorGUI.EndDisabledGroup();
        }
コード例 #4
0
    private void GenerateSphereMeshes()
    {
      foreach( var tuple in listClothBodiesGORadius_ )
      {
        GameObject go = tuple.First;

        if ( go == null)
        {
          continue;
        }
        
        float radius  = tuple.Second;

        Caronte_Fx_Body crBody = go.GetComponent<Caronte_Fx_Body>();
        
        if (crBody != null)
        {
          Mesh colliderMesh;
          Matrix4x4 colliderMatrixModelToWorld;

          bool isBakedColliderMesh = crBody.GetColliderMesh(out colliderMesh, out colliderMatrixModelToWorld );
    
          if (colliderMesh != null)
          {
            AddMeshSpheres(colliderMesh, colliderMatrixModelToWorld, radius);

            if (isBakedColliderMesh)
            {
              UnityEngine.Object.DestroyImmediate(colliderMesh);
            }
          }
        }
      }
    }
コード例 #5
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static bool HasValidColliderMesh(GameObject go)
        {
            Caronte_Fx_Body bodyComponent = go.GetComponent <Caronte_Fx_Body>();

            if (bodyComponent != null)
            {
                return(bodyComponent.HasValidCollider());
            }
            return(false);
        }
コード例 #6
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        public static Caronte_Fx_Body AddBodyComponentIfHasMesh(GameObject go)
        {
            Caronte_Fx_Body bodyComponent = go.GetComponent <Caronte_Fx_Body>();

            if (bodyComponent == null && go.HasMesh())
            {
                bodyComponent = go.AddComponent <Caronte_Fx_Body>();
            }

            return(bodyComponent);
        }
コード例 #7
0
        public bool AreFingerprintsValid()
        {
            Caronte_Fx_Body fxBody = gameObject_.GetComponent <Caronte_Fx_Body>();

            if (fxBody == null)
            {
                return(false);
            }

            return(AreMeshChecksValid(fxBody) && AreMeshFingerprintsValid(fxBody));
        }
コード例 #8
0
        public CarCreationData(GameObject go, Mesh renderMesh, Mesh colliderMesh, CRBalltreeAsset btAsset, bool isRope)
        {
            gameObject_ = go;
            isRope_     = isRope;

            positionRotationCanBeUpdated_ = true;

            renderFingerprint_   = null;
            colliderFingerprint_ = null;

            btAsset_ = btAsset;

            if (renderMesh != null)
            {
                renderFingerprint_ = new byte[256];
                CarGeometryUtils.CalculateFingerprint(renderMesh, renderFingerprint_);
            }

            if (colliderMesh != null)
            {
                colliderFingerprint_ = new byte[256];
                CarGeometryUtils.CalculateFingerprint(colliderMesh, colliderFingerprint_);
            }

            position_   = go.transform.position;
            rotation_   = go.transform.rotation;
            lossyScale_ = go.transform.lossyScale;

            positionCollider_   = Vector3.zero;
            rotationCollider_   = Quaternion.identity;
            lossyScaleCollider_ = Vector3.one;

            Caronte_Fx_Body fxBody = go.GetComponent <Caronte_Fx_Body>();

            if (fxBody != null)
            {
                colliderType_     = fxBody.ColliderType;
                hasValidCollider_ = fxBody.HasValidCollider();

                if (colliderType_ == Caronte_Fx_Body.EColliderType.CustomGameObject)
                {
                    GameObject goCollider = fxBody.GetColliderGameObject();

                    if (goCollider != null)
                    {
                        positionCollider_   = goCollider.transform.position;
                        rotationCollider_   = goCollider.transform.rotation;
                        lossyScaleCollider_ = goCollider.transform.lossyScale;
                    }
                }
            }
        }
コード例 #9
0
        private bool AreMeshFingerprintsValid(Caronte_Fx_Body fxBody)
        {
            bool isValid = true;

            if (renderFingerprint_ != null)
            {
                Mesh renderMesh;
                bool isBakedMesh = fxBody.GetRenderMesh(out renderMesh);

                if (renderMesh == null)
                {
                    return(false);
                }

                CarGeometryUtils.CalculateFingerprint(renderMesh, fingerprintAux_);
                isValid &= CarGeometryUtils.AreFingerprintsEqual(fingerprintAux_, renderFingerprint_);

                if (isBakedMesh)
                {
                    Object.DestroyImmediate(renderMesh);
                }
            }

            if (colliderFingerprint_ != null)
            {
                Mesh meshToCheck;
                bool isBakedMesh = false;
                if (isRope_)
                {
                    meshToCheck = fxBody.GetTileMesh();
                }
                else
                {
                    isBakedMesh = fxBody.GetColliderMesh(out meshToCheck);
                }

                if (meshToCheck == null)
                {
                    return(false);
                }

                CarGeometryUtils.CalculateFingerprint(meshToCheck, fingerprintAux_);
                isValid &= CarGeometryUtils.AreFingerprintsEqual(fingerprintAux_, colliderFingerprint_);

                if (isBakedMesh)
                {
                    Object.DestroyImmediate(meshToCheck);
                }
            }

            return(isValid);
        }
コード例 #10
0
        void OnEnable()
        {
            serializedColliderType_       = serializedObject.FindProperty("colliderType_");
            serializedColliderMesh_       = serializedObject.FindProperty("colliderMesh_");
            serializedColliderGameObject_ = serializedObject.FindProperty("colliderGameObject_");
            serializedColliderColor_      = serializedObject.FindProperty("colliderColor_");
            serializedColliderRenderMode_ = serializedObject.FindProperty("colliderRenderMode_");
            serializedTileMesh_           = serializedObject.FindProperty("tileMesh_");
            serializedBalltreeAsset_      = serializedObject.FindProperty("btAsset_");
            serializedRenderCollider_     = serializedObject.FindProperty("renderCollider_");

            cfxBody_ = (Caronte_Fx_Body)target;
        }
コード例 #11
0
        public Matrix4x4 GetCurrentMatrixLocalToWorld()
        {
            if (colliderType_ == Caronte_Fx_Body.EColliderType.CustomGameObject)
            {
                Caronte_Fx_Body bodyComponent      = gameObject_.GetComponent <Caronte_Fx_Body>();
                GameObject      colliderGameObject = bodyComponent.GetColliderGameObject();

                return(colliderGameObject.transform.localToWorldMatrix);
            }
            else
            {
                return(gameObject_.transform.localToWorldMatrix);
            }
        }
コード例 #12
0
    private void UpdateSoftBody( Transform tr, BodyInfo bdInfo )
    {
      SoftBodyInfo softInfo = (SoftBodyInfo)bdInfo;

      tr.localPosition = softInfo.center_;
      tr.localRotation = Quaternion.identity;
      tr.localScale    = Vector3.one;

      GameObject go = tr.gameObject;
      Caronte_Fx_Body cfxBody = go.GetComponent<Caronte_Fx_Body>();

      if (cfxBody != null && entityManager_.HasBodyMeshColliderRef(bdInfo.idBody_) )
      {
        UnityEngine.Mesh meshCollider = entityManager_.GetBodyMeshColliderRef(bdInfo.idBody_);

        if (meshCollider != null)
        {
          meshCollider.vertices = softInfo.arrVerticesCollider_;     
          meshCollider.RecalculateNormals();
          meshCollider.RecalculateBounds();
        }

        if (cfxBody.colliderMesh_ != meshCollider)
        {
          meshCollider.name = cfxBody.colliderMesh_.name;
          cfxBody.colliderMesh_ = meshCollider; 
        }
      }
     
      Tuple2<UnityEngine.Mesh, MeshUpdater> meshRenderData = entityManager_.GetBodyMeshRenderUpdaterRef(bdInfo.idBody_);
      UnityEngine.Mesh meshToUpdate = meshRenderData.First;
      MeshUpdater meshUpdater       = meshRenderData.Second;

      meshToUpdate.vertices = softInfo.arrVerticesRender_; 
      
      mcForUpdates.Clear();
      mcForUpdates.SetForUpdate(meshToUpdate);
      
      CaronteSharp.Tools.UpdateVertexNormalsAndTangents( meshUpdater, mcForUpdates );

      meshToUpdate.normals  = mcForUpdates.arrNormal_;
      meshToUpdate.tangents = mcForUpdates.arrTan_;

      meshToUpdate.RecalculateBounds();
    }
コード例 #13
0
        public void UpdatePositionRotation()
        {
            position_ = gameObject_.transform.position;
            rotation_ = gameObject_.transform.rotation;

            if (colliderType_ == Caronte_Fx_Body.EColliderType.CustomGameObject)
            {
                Caronte_Fx_Body bodyComponent = gameObject_.GetComponent <Caronte_Fx_Body>();

                if (bodyComponent != null)
                {
                    GameObject colliderGameObject = bodyComponent.GetColliderGameObject();

                    if (colliderGameObject != null)
                    {
                        positionCollider_ = colliderGameObject.transform.position;
                        rotationCollider_ = colliderGameObject.transform.rotation;
                    }
                }
            }
        }
コード例 #14
0
        public bool IsValidPositionRotation()
        {
            if (gameObject_ == null)
            {
                positionRotationCanBeUpdated_ = false;
                return(false);
            }

            if (gameObject_.transform.position != position_ ||
                gameObject_.transform.rotation != rotation_)
            {
                return(false);
            }

            if (colliderType_ == Caronte_Fx_Body.EColliderType.CustomGameObject)
            {
                positionRotationCanBeUpdated_ = false;

                Caronte_Fx_Body bodyComponent = gameObject_.GetComponent <Caronte_Fx_Body>();

                if (bodyComponent == null)
                {
                    return(false);
                }
                GameObject colliderGameObject = bodyComponent.GetColliderGameObject();

                if (colliderGameObject == null)
                {
                    return(false);
                }

                if (colliderGameObject.transform.position != positionCollider_ ||
                    colliderGameObject.transform.rotation != rotationCollider_)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #15
0
        public bool IsValidScale()
        {
            if (gameObject_ == null)
            {
                return(false);
            }

            if (gameObject_.transform.lossyScale != lossyScale_)
            {
                return(false);
            }

            if (colliderType_ == Caronte_Fx_Body.EColliderType.CustomGameObject)
            {
                Caronte_Fx_Body bodyComponent = gameObject_.GetComponent <Caronte_Fx_Body>();

                if (bodyComponent == null)
                {
                    return(false);
                }

                GameObject colliderGameObject = bodyComponent.GetColliderGameObject();

                if (colliderGameObject == null)
                {
                    return(false);
                }

                if (colliderGameObject.transform.lossyScale != lossyScaleCollider_)
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #16
0
        private void DrawCustomColliderFields()
        {
            Caronte_Fx_Body     component = (Caronte_Fx_Body)target;
            SkinnedMeshRenderer smr       = component.GetComponent <SkinnedMeshRenderer>();

            if (smr == null)
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedColliderType_, new GUIContent("Collider"));
                EditorGUILayout.EndHorizontal();

                Color curColor = GUI.contentColor;
                if (serializedColliderType_.enumValueIndex == 2)
                {
                    GUI.contentColor = Color.green;
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedColliderMesh_, new GUIContent("Custom Mesh"));
                GUI.contentColor = curColor;
                EditorGUILayout.EndHorizontal();

                if (serializedColliderType_.enumValueIndex == 3)
                {
                    GUI.contentColor = Color.green;
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedColliderGameObject_, new GUIContent("Custom GameObject"));
                GUI.contentColor = curColor;
                EditorGUILayout.EndHorizontal();


                if (!CarVersionChecker.IsPremiumVersion())
                {
                    EditorGUI.BeginDisabledGroup(true);
                }

                if (serializedColliderType_.enumValueIndex == 4)
                {
                    GUI.contentColor = Color.green;
                }
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedBalltreeAsset_, new GUIContent("Balltree Asset"));
                GUI.contentColor = curColor;
                EditorGUILayout.EndHorizontal();

                if (!CarVersionChecker.IsPremiumVersion())
                {
                    EditorGUI.EndDisabledGroup();
                }


                if (!CarVersionChecker.IsPremiumVersion() && serializedColliderType_.enumValueIndex == 4)
                {
                    EditorGUILayout.HelpBox("Balltree assets can only be used in CaronteFX Premium Version.", MessageType.Info);
                }

                EditorGUILayout.Space();
                EditorGUILayout.Space();

                EditorGUILayout.PropertyField(serializedRenderCollider_, new GUIContent("Render collider"));

                EditorGUI.BeginDisabledGroup(cfxBody_.IsUsingBalltree());
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedColliderColor_, new GUIContent("Color"));
                EditorGUILayout.EndHorizontal();
                EditorGUI.EndDisabledGroup();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(serializedColliderRenderMode_, new GUIContent("Render mode"));
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();
            }
        }
コード例 #17
0
        private bool AreMeshChecksValid(Caronte_Fx_Body fxBody)
        {
            if (colliderType_ != fxBody.ColliderType)
            {
                return(false);
            }

            if (hasValidCollider_ != fxBody.HasValidCollider())
            {
                return(false);
            }

            if (btAsset_ != fxBody.GetBalltreeAsset())
            {
                return(false);
            }
            else
            {
                Mesh colliderMesh;
                bool isBakedMesh = false;
                if (isRope_)
                {
                    colliderMesh = fxBody.GetTileMesh();
                }
                else
                {
                    isBakedMesh = fxBody.GetColliderMesh(out colliderMesh);
                }
                if (colliderFingerprint_ == null && colliderMesh != null ||
                    colliderFingerprint_ != null && colliderMesh == null)
                {
                    if (isBakedMesh)
                    {
                        Object.DestroyImmediate(colliderMesh);
                    }
                    return(false);
                }

                if (isBakedMesh)
                {
                    Object.DestroyImmediate(colliderMesh);
                }
            }

            {
                Mesh renderMesh;
                bool isBakedMesh = fxBody.GetRenderMesh(out renderMesh);

                if (renderFingerprint_ == null && renderMesh != null ||
                    renderFingerprint_ != null && renderMesh == null)
                {
                    if (isBakedMesh)
                    {
                        Object.DestroyImmediate(renderMesh);
                    }
                    return(false);
                }

                if (isBakedMesh)
                {
                    Object.DestroyImmediate(renderMesh);
                }
            }

            return(true);
        }
コード例 #18
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static void GetBalltreeAsset(GameObject go, ref CRBalltreeAsset btAsset)
        {
            Caronte_Fx_Body bodyComponent = go.GetComponent <Caronte_Fx_Body>();

            btAsset = bodyComponent.GetBalltreeAsset();
        }
コード例 #19
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static void GetColliderMeshData(GameObject go, ref Mesh meshCollider, out Matrix4x4 m_Collider_MODEL_to_WORLD, ref bool isBakedColliderMesh)
        {
            Caronte_Fx_Body bodyComponent = go.GetComponent <Caronte_Fx_Body>();

            isBakedColliderMesh = bodyComponent.GetColliderMesh(out meshCollider, out m_Collider_MODEL_to_WORLD);
        }
コード例 #20
0
        public void CreateBalltrees()
        {
            string folder;
            int    pathIndex;
            bool   assetsPath = CarFileUtils.DisplaySaveFolderDialog("CaronteFX - Balltree assets folder...", out folder, out pathIndex);

            if (!assetsPath)
            {
                return;
            }
            folder = folder.Substring(pathIndex);

            Dictionary <GameObject, uint> dictionaryGameObjectIdBalltree = new Dictionary <GameObject, uint>();
            HashSet <BalltreeId>          hashsetIdBalltree = new HashSet <BalltreeId>();

            GameObject[] arrGameObject = FieldController.GetUnityGameObjects();
            RgInit       rgInit        = new RgInit();

            Matrix4x4 m_MODEL_to_WORLD  = Matrix4x4.identity;
            bool      isBakedRenderMesh = false;

            int nGameObject = arrGameObject.Length;

            for (int i = 0; i < nGameObject; i++)
            {
                int   currentGOIdx = i + 1;
                float progress     = (float)currentGOIdx / (float)nGameObject;
                EditorUtility.DisplayProgressBar("CaronteFX - Balltree Generator", "Creating balltree for " + nGameObject + " GameObjects. GameObject " + currentGOIdx + ".", progress);
                GameObject go           = arrGameObject[i];
                Mesh       balltreeMesh = null;

                Caronte_Fx_Body cfxBody = CarBodyUtils.AddBodyComponentIfHasMesh(go);
                if (cfxBody != null)
                {
                    if (Data.CreationMode == CNBalltreeGenerator.ECreationMode.USERENDERERS)
                    {
                        CarBodyUtils.GetRenderMeshData(go, ref balltreeMesh, out m_MODEL_to_WORLD, ref isBakedRenderMesh);
                    }
                    else if (Data.CreationMode == CNBalltreeGenerator.ECreationMode.USECOLLLIDERS)
                    {
                        CarBodyUtils.GetColliderMeshData(go, ref balltreeMesh, out m_MODEL_to_WORLD, ref isBakedRenderMesh);
                    }

                    if (balltreeMesh != null)
                    {
                        SetRgInitForBalltree(go, balltreeMesh, rgInit);
                        uint id = RigidbodyManager.CreateBalltree(rgInit);

                        dictionaryGameObjectIdBalltree.Add(go, id);
                        hashsetIdBalltree.Add(new BalltreeId(id, balltreeMesh.name));
                    }
                }
            }

            int balltreeIdx = 1;
            int nBaltrees   = hashsetIdBalltree.Count;

            Dictionary <uint, CRBalltreeAsset> dictionaryIdBalltreeBalltreeAsset = new Dictionary <uint, CRBalltreeAsset>();

            foreach (BalltreeId balltreeId in hashsetIdBalltree)
            {
                float progress = (float)balltreeIdx / (float)nBaltrees;
                EditorUtility.DisplayProgressBar("CaronteFX - Balltree Generator", "Saving " + nBaltrees + " balltree assets. Balltree  " + balltreeIdx + ".", progress);

                byte[]      balltree_bytes            = RigidbodyManager.GetBalltreeBytes(balltreeId.id_);
                byte[]      balltreeCheckheader_bytes = RigidbodyManager.GetBalltreeCheckheaderBytes(balltreeId.id_);
                CarSphere[] arrLeafSphere             = RigidbodyManager.GetBalltreeSpheres(balltreeId.id_);

                CRBalltreeAsset btAsset = CreateBallTreeAsset(balltreeId.name_, folder, balltree_bytes, balltreeCheckheader_bytes, arrLeafSphere);

                dictionaryIdBalltreeBalltreeAsset.Add(balltreeId.id_, btAsset);
                balltreeIdx++;
            }
            EditorUtility.ClearProgressBar();

            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();

            ICollection <GameObject> goCollection = dictionaryGameObjectIdBalltree.Keys;

            foreach (GameObject go in goCollection)
            {
                Caronte_Fx_Body cfxBody = go.GetComponent <Caronte_Fx_Body>();
                if (cfxBody == null)
                {
                    cfxBody = go.AddComponent <Caronte_Fx_Body>();
                }

                uint            idBalltree = dictionaryGameObjectIdBalltree[go];
                CRBalltreeAsset btAsset    = dictionaryIdBalltreeBalltreeAsset[idBalltree];
                cfxBody.SetBalltreeAsset(btAsset);
                EditorUtility.SetDirty(cfxBody);
            }
        }
コード例 #21
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static bool AddBodyComponentIfHasMeshReturnHasValidRenderMesh(GameObject go)
        {
            Caronte_Fx_Body bodyComponent = AddBodyComponentIfHasMesh(go);

            return(bodyComponent != null && go.HasMesh());
        }
コード例 #22
0
ファイル: CarBodyUtils.cs プロジェクト: kingBook/unity_demos
        //-----------------------------------------------------------------------------------
        public static bool AddBodyComponentIfHasMeshReturnHasValidColliderOrBalltree(GameObject go)
        {
            Caronte_Fx_Body bodyComponent = AddBodyComponentIfHasMesh(go);

            return(bodyComponent != null && (bodyComponent.HasValidCollider() || bodyComponent.IsUsingBalltree()));
        }
コード例 #23
0
        private bool AreFingerprintsValidNonAnimatedByArrPos()
        {
            bool isValid = true;

            Mesh renderMesh = gameObject_.GetMesh();

            byte[] fingerPrint = new byte[256];
            if (renderFingerprint_ != null)
            {
                if (renderMesh != null)
                {
                    CRGeometryUtils.CalculateFingerprint(renderMesh, fingerPrint);
                    isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, renderFingerprint_);
                }
                else
                {
                    return(false);
                }
            }

            if (colliderFingerprint_ != null)
            {
                Caronte_Fx_Body fxBody = gameObject_.GetComponent <Caronte_Fx_Body>();
                if (fxBody != null)
                {
                    if (fxBody.IsConvexHull() != isConvexHull_)
                    {
                        return(false);
                    }

                    if (fxBody.tileMesh_ != null)
                    {
                        CRGeometryUtils.CalculateFingerprint(fxBody.tileMesh_, fingerPrint);
                        isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, colliderFingerprint_);
                    }
                    else if (fxBody.colliderType_ == Caronte_Fx_Body.ColliderType.MeshFilter)
                    {
                        if (renderMesh != null)
                        {
                            CRGeometryUtils.CalculateFingerprint(renderMesh, fingerPrint);
                            isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, colliderFingerprint_);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else if (fxBody.colliderType_ == Caronte_Fx_Body.ColliderType.MeshFilterConvexHull)
                    {
                        if (renderMesh != null)
                        {
                            CRGeometryUtils.CalculateFingerprint(renderMesh, fingerPrint);
                            isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, colliderFingerprint_);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                    else if (fxBody.colliderType_ == Caronte_Fx_Body.ColliderType.CustomMesh)
                    {
                        Mesh colliderMesh = fxBody.colliderMesh_;
                        if (colliderMesh != null)
                        {
                            CRGeometryUtils.CalculateFingerprint(colliderMesh, fingerPrint);
                            isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, colliderFingerprint_);
                        }
                        else if (renderMesh != null)
                        {
                            CRGeometryUtils.CalculateFingerprint(renderMesh, fingerPrint);
                            isValid &= CRGeometryUtils.AreFingerprintsEqual(fingerPrint, colliderFingerprint_);
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }
                else
                {
                    return(false);
                }
            }
            return(isValid);
        }