Hey Micheal, check out the Decal sample. I’m pretty sure it raycasts from mouse cursor.
But if you have the mouse hidden at the center of the screen you have to do something like this (in lua, easily convertable):
function Raycast(maxDistance)
local pos=Vector2(graphics.width/2,graphics.height/2)
local camera = cameraNode:GetComponent("Camera")
local cameraRay = camera:GetScreenRay(pos.x / graphics.width, pos.y / graphics.height)
local octree = scene_:GetComponent("Octree")
local result = octree:Raycast(cameraRay, RAY_TRIANGLE, maxDistance, DRAWABLE_GEOMETRY)
return result
end
Returns your result nodes, which can be multiple or one if you want.
Depending on what this raycast is used for, you might approach the issue differently.