sio2UnProject? Point on a plane from touch position

View previous topic View next topic Go down

sio2UnProject? Point on a plane from touch position

Post  Tom on Sun May 03, 2009 2:16 am

Hi

I guess this isn't strictly an SIO2 question but more a general 3d one. Anyway, I want to determine the coordinate that a touch on the screen meets a plane in world space. I'm guessing that I need to use sio2Unproject but I'm not sure what to call it with, or what exactly I get in return. Can anyone help me out?

Tom

Posts : 13
Join date : 2009-03-23

View user profile

Back to top Go down

Re: sio2UnProject? Point on a plane from touch position

Post  Tom on Sun May 03, 2009 3:40 am

I figured it out! Smile

Code:
   
sio2UnProject(touch.x,
     touch.y, 0.0f,
     sio2->_SIO2camera->mat_modelview,
     sio2->_SIO2camera->mat_projection,
     sio2->_SIO2window->mat_viewport,
     &x1, &y1, &z1);

Call it twice with two different Z values and you have your ray!

Tom

Posts : 13
Join date : 2009-03-23

View user profile

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum