public bool GetCollisionPoint(Line3D ray, TriangleSelector selector, out Vector3D collisionPoint, out Triangle3D collisionTriangle)
 {
     float[] colp = new float[3];
     float[] coltri = new float[9];
     bool toR = SceneCollisionManager_GetCollisionPoint(_raw, ray.ToUnmanaged(), selector.Raw, colp, coltri);
     collisionPoint = Vector3D.FromUnmanaged(colp);
     collisionTriangle = Triangle3D.FromUnmanaged(coltri);
     return toR;
 }
 public SceneNode GetSceneNodeFromRay(Line3D ray)
 {
     return GetSceneNodeFromRay(ray, 0, false);
 }
 public SceneNode GetSceneNodeFromRay(Line3D ray, int bitMask, bool noDebug)
 {
     return (SceneNode)
         NativeElement.GetObject(SceneCollisionManager_GetSceneNodeFromRayBB(_raw, ray.ToUnmanaged(), bitMask, noDebug),
                                 typeof(SceneNode));
 }
Beispiel #4
0
        /// <summary>
        /// Checks an intersection with some line
        /// </summary>
        /// <param name="lineToCol">
        /// A line to be checked <see cref="Line3D"/>
        /// </param>
        /// <returns>
        /// A result of the collision <see cref="System.Boolean"/>
        /// </returns>
        public bool IntersectsWithLimitedLine(Line3D lineToCol)
        {

            Vector3D lineVector = lineToCol.Vector.Normalize();
            float halfLength = (float)(lineToCol.Length * 0.5);
            Vector3D t = Center - lineToCol.Middle;
            Vector3D e = (MaxEdge - MinEdge); e = e * (float)(0.5);

            if ((Math.Abs(t.X) > e.X + halfLength * Math.Abs(lineVector.X)) ||
                (Math.Abs(t.Y) > e.Y + halfLength * Math.Abs(lineVector.Y)) ||
                (Math.Abs(t.Z) > e.Z + halfLength * Math.Abs(lineVector.Z)))
                return false;

            float r = e.Y * Math.Abs(lineVector.Z) + e.Z * Math.Abs(lineVector.Y);
            if (Math.Abs(t.Y * lineVector.Z - t.Z * lineVector.Y) > r)
                return false;

            r = e.X * Math.Abs(lineVector.Z) + e.Z * Math.Abs(lineVector.X);
            if (Math.Abs(t.Z * lineVector.X - t.X * lineVector.Z) > r)
                return false;

            r = e.X * Math.Abs(lineVector.Y) + e.Y * Math.Abs(lineVector.X);
            if (Math.Abs(t.X * lineVector.Y - t.Y * lineVector.X) > r)
                return false;

            return true;

        }
Beispiel #5
0
 public void Draw3DLine(Line3D line, Color color)
 {
     Draw3DLine(line.Start, line.End, color);
 }
Beispiel #6
0
 public static Line3D From(float xMin, float yMin, float zMin, float xMax, float yMax, float zMax)
 {
     Line3D line = new Line3D();
     line.Start = new Vector3D();
     line.End = new Vector3D();
     line.Start.Set(xMin, yMin, zMin);
     line.End.Set(xMax, yMax, zMax);
     return line;
 }