示例#1
0
        public Vector3 DonnerVectorCollision(PrimitiveDeBaseAnimée a)
        {
            Vector3 v = Vector3.Zero;

            if ((a as Soldat).HitBoxGénérale.Intersects(HitBoxGénérale))
            {
                v = new Vector3(42, 0, 0);

                if (CôtéVentilateur == "Droite")
                {
                    v = -v;
                }
            }
            return(v);
        }
        public Vector3 DonnerVectorCollision(PrimitiveDeBaseAnimée a)
        {
            Vector3 v = Vector3.Zero;

            if (HitBoxPlanIncliné.Intersects((a as Soldat).HitBoxGénérale))
            {
                if ((a as Soldat).HitBoxGénérale.Min.Y <= CalculerHauteur((a as Soldat).Position.Z))
                {
                    (a as Soldat).EstSurTerrain  = true;
                    (a as Soldat).EstEnCollision = true;
                    // float angle = (float)Math.Atan(Dimension.Y / Dimension.Z);
                    v = new Vector3((a as Soldat).VecteurResultantForce.X, -(a as Soldat).VecteurResultantForce.Y, (a as Soldat).VecteurResultantForce.Z); //(float)Math.Cos(angle) * 9.81f,-(a as Soldat).VecteurResultantForce.Y
                    (a as Soldat).Vitesse = new Vector3((a as Soldat).Vitesse.X, 0, (a as Soldat).Vitesse.Z);
                }
            }
            return(v);
        }
        public virtual Vector3 DonnerVectorCollision(PrimitiveDeBaseAnimée a)
        {
            Vector3 vitesseTemp = (a as Soldat).Vitesse;

            Vector3 forceTemp = (a as Soldat).VecteurResultantForce;
            Vector3 v         = Vector3.Zero;

            if (HitBoxGénérale.Intersects((a as Soldat).HitBoxGénérale))
            {
                // c mon

                v = a.Position - Position;
                v = new Vector3(v.X / (HOMOTHETHIE_STANDARD * TAILLE_HITBOX_STANDARD.X), v.Y / (HOMOTHETHIE_STANDARD * TAILLE_HITBOX_STANDARD.Y), (v.Z / HOMOTHETHIE_STANDARD * TAILLE_HITBOX_STANDARD.Z));

                v = Convert.ToInt32((v.Y >= v.X) && (v.Y >= v.Z) && (vitesseTemp.Y < -0.0001f) && v.Y >= 0.0001f) * VECTOR_HAUT

                    + Convert.ToInt32((v.Y <= v.X) && (v.Y <= v.Z) && (vitesseTemp.Y > 0.0001f) && (v.Y <= -0.0001f)) * VECTOR_BAS

                    + Convert.ToInt32((v.Z >= v.X) && (v.Z >= v.Y) && vitesseTemp.Z <-0.0001f && v.Z> 0.0001f) * VECTOR_DEVANT

                    + Convert.ToInt32((vitesseTemp.X >= 0.001f) && (v.X <= -0.0001f) && (Math.Abs(v.X) >= Math.Abs(v.Y)) && (Math.Abs(v.X) >= Math.Abs(v.Z))) * VECTOR_GAUCHE

                    + Convert.ToInt32(vitesseTemp.X <= -0.0001f && v.X >= 0.0001f && (Math.Abs(v.X) >= Math.Abs(v.Y)) && (Math.Abs(v.X) >= Math.Abs(v.Z))) * VECTOR_DROITE

                    + Convert.ToInt32((Math.Abs(v.Z) >= Math.Abs(v.X)) && (Math.Abs(v.Z) >= Math.Abs(v.Y)) && vitesseTemp.Z > 0.0001f && v.Z < -0.0001f) * VECTOR_DERRIERE
                ;

                if (v.Y > 0)
                {
                    (a as Soldat).EstSurTerrain = true;
                }

                (a as Soldat).EstEnCollision = true;

                (a as Soldat).Vitesse += new Vector3(v.X * Math.Abs(vitesseTemp.X), v.Y * Math.Abs(vitesseTemp.Y), v.Z * Math.Abs(vitesseTemp.Z));
                //  v = new Vector3(v.X * forceTemp.X, v.Y * forceTemp.Y, v.Z * forceTemp.Z);
                GarderHorsBornes((a as Soldat), v);

                SuivreTerrain(a as Soldat);
            }
            return(-v);
        }
示例#4
0
        public Vector3 DonnerVectorCollision(PrimitiveDeBaseAnimée a)
        {
            Vector3 v = Vector3.Zero;


            if ((a as Soldat).HitBoxGénérale.Intersects(HitBoxGénérale))
            {
                for (int i = 0; i < NB_HITBOX_PRÉCISES; i++)
                {
                    if ((a as Soldat).HitBoxGénérale.Intersects(TableauxHitBoxPrécises[i]))
                    {
                        Vector3 EntreSphèreetPers = (TableauxHitBoxPrécises[i].Center - a.Position);
                        // (a as Soldat).Vitesse = new Vector3((a as Soldat).Vitesse.X, (a as Soldat).Vitesse.Y, 0);
                        Vector3 temp = sens * 2800 * new Vector3(1, 0.5f, 0); //(Angle / Math.Abs(Angle))
                        v = new Vector3(temp.X, Math.Abs(temp.Y), 0);
                    }
                }
            }
            return(v);
        }
示例#5
0
 public Vector3 DonnerVectorCollision(PrimitiveDeBaseAnimée a)
 {
     return(Vector3.Zero);
 }