CameraToViewportRay

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
madtulip
Halfling
Posts: 78
Joined: Thu Nov 18, 2004 6:35 pm

CameraToViewportRay

Post by madtulip »

Code: Select all

Ray mouseRay = mCamera->getCameraToViewportRay( e->getX(), e->getY() );
seem to be performed internaly by the cameras position and orientaion, rather then its derivered position and rerivered orientaion. why could that be usefull ?

in my application i got a 3rd person camera behind a ship. the node are set up like

controlnode
shipnode (child of controlnode)
cameranode (child of controlnode)

if i start a CameraToViewportRay the rays works with the position and orientation of the camera relative to the controlnode. atm i cant see why that should be usefull, as the picture the camera is producing is also been taken from the derivered position and derivered orientation.as the name "camera to viewport ray" indicates i want to shoot the ray to the viewport, the not derivered orientation and position is not in all cases the viewport (the things i can see, as far as i understand that word) i can see.

maybe i made a mistake in my code, but this behavior was quite irritating to me first. im now using to get the derivered position and orientation of my cameranode (child of controlnode) and place a newcameranode (child of root node) at that settings from wich it seems to work well.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

I think you must be using an old version. Camera does use the derived position and derived orientation to determine the viewport ray.
madtulip
Halfling
Posts: 78
Joined: Thu Nov 18, 2004 6:35 pm

Post by madtulip »

im using the sdk and you where right. the position is derivered. the problem was and is at the other end of the ray, the mousecursor. the x and y coordinates where bugged due to a failur i made in the code.im sorry.