How do I convert CGPoint coordinates to device coordinates for RaySceneQuery? I'm using the code below but the ray does not return the intersection result correctly.
Code: Select all
-(void) touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event
{
UITouch *touch = [touches anyObject];
NSUInteger numTaps = [touch tapCount];
CGPoint pt = [touch locationInView:self];
if ( numTaps > 1 )
{
Ogre::Real newX = (pt.x - (320 / 2)) / (320 /2);
Ogre::Real newY = (pt.y - (480 / 2)) / (480 /2);
Ogre::Ray mouseRay = cameraPtr->getCameraToViewportRay(newX, newY);
}
}
CG