FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

sio2UnProject? Point on a plane from touch position

Go down

sio2UnProject? Point on a plane from touch position Empty sio2UnProject? Point on a plane from touch position

Post  Tom 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

Back to top Go down

sio2UnProject? Point on a plane from touch position Empty Re: sio2UnProject? Point on a plane from touch position

Post  Tom 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

Back to top Go down

Back to top

- Similar topics

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