コード例 #1
0
ファイル: AxisAlignedBB.cs プロジェクト: Entrivax/42run
        public bool IntersectWith(Vector3 thisOffset, AxisAlignedBB other, Vector3 otherOffset)
        {
            var thisOffsetted  = new AxisAlignedBB(Min + thisOffset, Max + thisOffset);
            var otherOffsetted = new AxisAlignedBB(other.Min + otherOffset, other.Max + otherOffset);

            return(thisOffsetted.IntersectWith(otherOffsetted));
        }
コード例 #2
0
ファイル: GroundStairs.cs プロジェクト: Entrivax/42run
        public GroundStairs(Direction direction)
        {
            Mesh      = MeshToUse;
            Direction = direction;
            Length    = 1.2f;
            var rotation = DirectionHelper.GetRotationFromDirection(direction);
            var p1       = new Vector4(-3f, 0f, -Length, 1) * rotation;
            var p2       = new Vector4(3f, 0.3f, 0f, 1) * rotation;
            var p1v3     = new Vector3(p1);
            var p2v3     = new Vector3(p2);

            BoundingBox = new AxisAlignedBB(Vector3.ComponentMin(p1v3, p2v3), Vector3.ComponentMax(p1v3, p2v3));
        }
コード例 #3
0
ファイル: AxisAlignedBB.cs プロジェクト: Entrivax/42run
 public bool IntersectWith(AxisAlignedBB other)
 {
     if (other == null)
     {
         return(false);
     }
     if (other.Max.X <= Min.X || other.Min.X >= Max.X)
     {
         return(false);
     }
     if (other.Max.Y <= Min.Y || other.Min.Y >= Max.Y)
     {
         return(false);
     }
     return(other.Max.Z > Min.Z && other.Min.Z < Max.Z);
 }
コード例 #4
0
ファイル: GroundSimple.cs プロジェクト: Entrivax/42run
        public GroundSimple(Direction direction)
        {
            Mesh      = MeshToUse;
            Direction = direction;
            Length    = 6f;
            var rotation = DirectionHelper.GetRotationFromDirection(direction);
            var p1       = new Vector4(-3f, -0.5f, -Length, 1) * rotation;
            var p2       = new Vector4(3f, 0f, 0f, 1) * rotation;

            PossibleObstaclePositions = new Vector3[2];
            for (int i = 0; i < 2; i++)
            {
                PossibleObstaclePositions[i] = (new Vector4(0, 0, -i * 3, 1) * rotation).Xyz;
            }
            BoundingBox = new AxisAlignedBB(Vector3.ComponentMin(p1.Xyz, p2.Xyz), Vector3.ComponentMax(p1.Xyz, p2.Xyz));
        }
コード例 #5
0
ファイル: Obstacle.cs プロジェクト: Entrivax/42run
 public Obstacle(AxisAlignedBB boundingBox, Vector3 position, Direction direction)
 {
     BoundingBox = boundingBox;
     Position    = position;
     Direction   = direction;
 }
コード例 #6
0
 public ObstacleTrash(AxisAlignedBB boundingBox, Vector3 position, Direction direction) : base(boundingBox, position, direction)
 {
     Mesh = MeshToUse;
 }