Placing emitter at touch location - viewport size smaller than screen - tutorial 12
4 posters
Placing emitter at touch location - viewport size smaller than screen - tutorial 12
I am experimenting with tutorial 12. I am trying to get the emitter location to move to where I touch the screen. I am able to get the emitter to move with this code:
However, the emitter isn't visible after I do that. It appears the x,y location for the touch is outside the viewport (or otherwise off the screen).
Dividing the touch location by 100 will move the emitter from it's original location and make it visible (although it doesn't move to where I touched):
That makes me think the grid for SIO is smaller than the grid for the screen. I think I need to set the viewport to match the screen size for this to work. I looked for where the viewport gets set. I found this reference to the viewport, but I can't really tell what it does:
I am a complete newb, so I really appreciate your help. Please don't assume I know what to do, I just learned what a viewport was yesterday.
- Code:
_SIO2emitter->_SIO2transform->loc->x = _SIO2window->touch[ 0 ].x;
_SIO2emitter->_SIO2transform->loc->y = _SIO2window->touch[ 0 ].y;
However, the emitter isn't visible after I do that. It appears the x,y location for the touch is outside the viewport (or otherwise off the screen).
Dividing the touch location by 100 will move the emitter from it's original location and make it visible (although it doesn't move to where I touched):
- Code:
_SIO2emitter->_SIO2transform->loc->x = _SIO2window->touch[ 0 ].x/100;
_SIO2emitter->_SIO2transform->loc->y = _SIO2window->touch[ 0 ].y/100;
That makes me think the grid for SIO is smaller than the grid for the screen. I think I need to set the viewport to match the screen size for this to work. I looked for where the viewport gets set. I found this reference to the viewport, but I can't really tell what it does:
- Code:
sio2WindowUpdateViewport( sio2->_SIO2window, 0, 0, backingWidth, backingHeight );
I am a complete newb, so I really appreciate your help. Please don't assume I know what to do, I just learned what a viewport was yesterday.
gezerk- Posts : 2
Join date : 2009-04-30
Re: Placing emitter at touch location - viewport size smaller than screen - tutorial 12
_SIO2window->touch[ 0 ] is just the position on your iphone's screen, not the position in your 3d world. Test tutorial 5 in the simulator and look at touch position, thats should give you an idea of _SIO2window->touch works
oioioi- Posts : 136
Join date : 2008-12-02
Location : Norway
Re: Placing emitter at touch location - viewport size smaller than screen - tutorial 12
oioioi wrote:_SIO2window->touch[ 0 ] is just the position on your iphone's screen, not the position in your 3d world. Test tutorial 5 in the simulator and look at touch position, thats should give you an idea of _SIO2window->touch works
I took a look at tutorial 5. I understand the touch position is the screen position. What I don't understand is how that translates to the 3D world. Tutorial 5 didn't seem to help since all it does is display the touch position on the screen. I think I need to understand how the dimensions of the 3D world get set so I can either adjust the screen touch to fit 3D, or set 3D to match the screen.
gezerk- Posts : 2
Join date : 2009-04-30
Re: Placing emitter at touch location - viewport size smaller than screen - tutorial 12
Check for sio2Project & sio2UnProject, they are acting the same way as gluProject and gluUnProject... with that you can do 2D -> 3D coordinate or 3D -> 2D coordinate conversion.
Hi
Can you be some more specific please
where can i find sio2Project working code.
I am very new to sio2 so I am not getting through these keywords
it will be a great help .
Thanks
Naren
where can i find sio2Project working code.
I am very new to sio2 so I am not getting through these keywords
it will be a great help .
Thanks
Naren
narender.mudgal- Posts : 7
Join date : 2009-08-08
Similar topics
» Emitter position
» Placing particles emitter in front of camera
» Problems with the emitter tutorial
» Stopping emitter after 1 'cycle'
» Get the 2D location of an 3D object
» Placing particles emitter in front of camera
» Problems with the emitter tutorial
» Stopping emitter after 1 'cycle'
» Get the 2D location of an 3D object
Permissions in this forum:
You cannot reply to topics in this forum