コード例 #1
0
        public static bool TestPlaneOBB(Plane_ p, OBB obb)//UNUSED??
        {
            Stats.TestPlaneOBB++;

            return(true);

            var nor       = p.Normal;
            var minradius = obb.HalfAxisWidth.X * (Math.Abs(Vector3.Dot(nor, obb.Axis(0))) + obb.HalfAxisWidth.Y * Math.Abs(Vector3.Dot(nor, obb.Axis(1))));

            return(Vector3.Dot(obb.Position, p.Normal) < p.dist + minradius + 0.01f);

            return(true);
        }
コード例 #2
0
        public static Plane[] FromTSObject(dynamic[] tsArray)
        {
            if (tsArray is null)
            {
                return(null);
            }
            var list = new System.Collections.Generic.List <Plane>();

            foreach (var tsItem in tsArray)
            {
                list.Add(Plane_.FromTSObject(tsItem));
            }
            return(list.ToArray());
        }
コード例 #3
0
        public static dynamic GetTSObject(Plane[] dynArray)
        {
            if (dynArray is null)
            {
                return(null);
            }
            var list = new System.Collections.Generic.List <dynamic>();

            foreach (var dynItem in dynArray)
            {
                list.Add(Plane_.GetTSObject(dynItem));
            }
            return(list.ToArray());
        }
コード例 #4
0
        public static bool Bounce_Point_Mass_Off_Plane(Plane_ p, Point_Mass_Body par)
        {
            var pd = Vector3.Dot(par.Position, p.Normal);
            var d = p.dist;
            d -= pd;
            if (d < 0) return false;
            par.Position += d * p.Normal;
            var mo = par.Momentum;
            var dot = Vector3.Dot(p.Normal, mo);
            if (dot < 0)
            {
                mo -= 2 * dot * p.Normal;
                par.Momentum = mo;
            }

            return true;
        }
コード例 #5
0
        public static bool Bounce_Point_Mass_Off_Plane(Plane_ p, Point_Mass_Body par)
        {
            var pd = Vector3.Dot(par.Position, p.Normal);
            var d  = p.dist;

            d -= pd;
            if (d < 0)
            {
                return(false);
            }
            par.Position += d * p.Normal;
            var mo  = par.Momentum;
            var dot = Vector3.Dot(p.Normal, mo);

            if (dot < 0)
            {
                mo          -= 2 * dot * p.Normal;
                par.Momentum = mo;
            }

            return(true);
        }
コード例 #6
0
        public static bool CoarsePlaneSphere(Plane_ p, Sphere s)
        {
            Stats.TestPlaneSphere++;

            return(Vector3.Dot(s.Position, p.Normal) < p.dist + s.Radius);
        }
コード例 #7
0
        public static bool CoarsePlaneSphere(Plane_ p, Sphere s)
        {
            Stats.TestPlaneSphere++;

            return Vector3.Dot(s.Position, p.Normal) < p.dist + s.Radius;
        }
コード例 #8
0
        //UNUSED??
        public static bool TestPlaneOBB(Plane_ p, OBB obb)
        {
            Stats.TestPlaneOBB++;

            return true;
            var nor = p.Normal;
            var minradius = obb.HalfAxisWidth.X * (Math.Abs(Vector3.Dot(nor, obb.Axis(0))) + obb.HalfAxisWidth.Y * Math.Abs(Vector3.Dot(nor, obb.Axis(1))));
            return Vector3.Dot(obb.Position, p.Normal) < p.dist + minradius + 0.01f;

            return true;
        }