Code: Select all
getRayFromScreenCoordinates (position2d<s32>(mousex,mousey)
Code: Select all
ray = collMan->getRayFromScreenCoordinates (position2d<s32>(mousex,mousey),0);
selectedSceneNode = collMan->getSceneNodeAndCollisionPointFromRay(ray, intersection, hitTriangle, 0, 0);
Way to use my mouse as a pointer. What I've realised is that since the mouse is way behind the screen, if I intersect the ray with a plane such as (0,1,0) the point of intersection is NOT above my mouse, but somewhere halfway between the 'ray start' and where my mouse is.
What this means is that just because my mouse is over a scene node, it doesnt mean getRayFromScreenCoordinates will pass through it
I can provide screenshots if what I'm saying sounds like a bug.
Should I hide the windows mouse, and draw a cursor on the actual plane I'm interested as a billboard? Then I would have very good accuracy when doing selections. However, I wouldnt be able to move my 'cursor' to the rightmost and bottommost corners.
Does this sound right? or like something is fundamentally wrong?
(camera) (lets say (0,0,0), V is down on Y, > + on X)
\
-\
--\--(the intersection I find) (something like (5,-5) )
- -\
- --\ (where my mouse appears to be) (8 on X)
so when I do the test, it returns 5, not 8. Make sence? :S
Thanks!
EDIT:
Instead, if I find the ray.end, and cast a line with the negative vector of the camera lookat, from ray.end, would that be my 'offset' by mouse position? I'll try that tommorow when im fresh