[SOLVED] Raycast to backside

I have plane with dualside material. I use this function for raycasting:

bool CanvasLogic::RaycastToCanvas(Vector3& hitPos) { auto mousePos = INPUT->GetMousePosition(); auto camera = GetScene()->GetChild("Camera")->GetComponent<Camera>(); float x = (float)mousePos.x_ / GRAPHICS->GetWidth(); float y = (float)mousePos.y_ / GRAPHICS->GetHeight(); auto cameraRay = camera->GetScreenRay(x, y); PODVector<RayQueryResult> results; RayOctreeQuery query(results, cameraRay, RAY_TRIANGLE, 1000.0f, DRAWABLE_GEOMETRY); GetScene()->GetComponent<Octree>()->Raycast(query); foreach(auto result, results) { if (result.node_ == node_) { hitPos = result.position_; return true; } } return false; }

But it works only for forward side. How to fix it?

RAY_OBB works fine for my (canvas has rectangle shape)

Ray test functions currently don’t support a twosided parameter. Shouldn’t be impossible to add.

Another way would be to create a model with double vertices having identical vertex positions, but opposite normals. To easily achieve this with any model in Blender:


  • Enter edit mode (Tab)
  • Select all (A (x2))
  • Duplicate (Shift+D)
  • Cancel grab (Esc or right mouse button)
  • Flip the face normals (Ctrl+F then F)
    Note that this will double the vertex count.
    To restore the earlier state of the object without undo you can:


  • Select all (A (x2))
  • Remove Doubles (W then R)
  • Recalculate Normals (Ctrl(+Shift)+N)

Furthermore it might be useful to know the L key adds all elements linked to the element closest to the cursor to the selection, Shift + L deselects in the same manner.