Vector3df Camera :: cameraTarget() call anyone

Hello Everyone!
I want to procure a RayCast from my camera to anywhere else in the scene my mouse cursor goes.
To do this we need a cameraTarget or cameraLook. I cannpt find anything similar in the docs.

Can you help?
Thanks
Michael S.

There is Node::LookAt(), although there may be a better way

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.

It sounds like you’re looking for a way to implement basic mouse look. This would not require raycasting, instead converting cursor movement to the camera’s node rotation should suffice. But I may not be seeings things.

Also, welcome to the forums! :confetti_ball: :slightly_smiling_face: