예제 #1
0
        public static JRigidbody[] OverlapMesh(Shape shape, Vector3 position, Quaternion rotation)
        {
            var list = new List<JRigidbody>();
            JMatrix orientation = rotation.ConvertToJMatrix(), otherOrientation;
            JVector pos = position.ConvertToJVector(),otherPosition, point, normal;
            float penetration;
            foreach (var body in Bodies)
            {
                if (body.Key.Shape is Multishape) continue;

                otherPosition = body.Key.Position;
                otherOrientation = body.Key.Orientation;
                bool collide = XenoCollide.Detect(shape, body.Key.Shape, ref orientation, ref otherOrientation,
                                                  ref pos, ref otherPosition, out point, out normal,
                                                  out penetration);
                if(collide) list.Add(body.Value);
            }
            return list.ToArray();
        }