/// <summary> /// Method that actually initiates the raycast /// </summary> /// <param name="req"></param> private void RayCast(ODERayRequest req) { // limit ray length or collisions will take all avaiable stack space float len = req.length; if (len > 100f) { len = 100f; } // Create the ray IntPtr ray = SafeNativeMethods.CreateRay(m_scene.space, len); SafeNativeMethods.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); // Collide test SafeNativeMethods.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); // Remove Ray SafeNativeMethods.GeomDestroy(ray); // Find closest contact and object. lock (m_contactResults) { // Return results if (req.callbackMethod != null) { req.callbackMethod(m_contactResults); } } }
/// <summary> /// Method that actually initiates the raycast /// </summary> /// <param name="req"></param> private void RayCast(ODERayRequest req) { // Create the ray IntPtr ray = d.CreateRay(m_scene.space, req.length); d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); // Collide test d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); // Remove Ray d.GeomDestroy(ray); // Find closest contact and object. lock (m_contactResults) { // Return results if (req.callbackMethod != null) { req.callbackMethod(m_contactResults); } } }
/// <summary> /// Method that actually initiates the raycast /// </summary> /// <param name="req"></param> private void RayCast(ODERayRequest req) { // Create the ray IntPtr ray = d.CreateRay(m_scene.space, req.length); d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); // Collide test d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); // Remove Ray d.GeomDestroy(ray); // Find closest contact and object. lock (m_contactResults) { // Return results if (req.callbackMethod != null) req.callbackMethod(m_contactResults); } }
/// <summary> /// Method that actually initiates the raycast /// </summary> /// <param name="req"></param> private void RayCast(ODERayRequest req) { // limit ray length or collisions will take all avaiable stack space float len = req.length; if (len > 100f) len = 100f; // Create the ray IntPtr ray = d.CreateRay(m_scene.space, len); d.GeomRaySet(ray, req.Origin.X, req.Origin.Y, req.Origin.Z, req.Normal.X, req.Normal.Y, req.Normal.Z); // Collide test d.SpaceCollide2(m_scene.space, ray, IntPtr.Zero, nearCallback); // Remove Ray d.GeomDestroy(ray); // Find closest contact and object. lock (m_contactResults) { // Return results if (req.callbackMethod != null) req.callbackMethod(m_contactResults); } }