Exemplo n.º 1
0
        //-----------------------------------------------------------------------------------
        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();
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
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);
        }