Increase hit region of an object

View previous topic View next topic Go down

Increase hit region of an object

Post  ludi on Sun Jan 18, 2009 7:07 am

Hi,

I Is it possible to increase the hit region from a specific object?
In my 3d world exist some small objects and it is very difficult to touch/select (sio2ResourceSelect3D) these objects with the touch screen from the iPhone.

How can I do this? Or is it necessary to change the coordinates and invoke the sio2ResourceSelect3D method again?

Thanks a lot
ludi

ludi

Posts : 14
Join date : 2008-10-19

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  meteors on Sun Jan 18, 2009 10:07 am

Are your objects moving?

If they are *not* moving, you can always define a square region in the screen tap callback, like this:

void templateScreenTap( void *_ptr, unsigned char _state )
{
unsigned int tap = sio2->_SIO2window->n_tap;
unsigned int my_x = sio2->_SIO2window->touch[ 0 ]->x;
unsigned int my_y = sio2->_SIO2window->touch[ 0 ]->y;

if( _state == SIO2_WINDOW_TAP_DOWN && level == 1){

//if we clicked a button in the lower left area
if((tap == 1) && (my_x > 10) && (my_x < 100) && (my_y > 10) && (my_y < 100)){

doWhatever();
}
}
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  ludi on Sun Jan 18, 2009 10:16 am

My object does not move, but it is possible that the camera is moving.
So this is not the right solution for me.

Any further ideas?

ludi

Posts : 14
Join date : 2008-10-19

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  meteors on Sun Jan 18, 2009 10:37 am

You could create a larger invisible object around each object, and use it for the selection...



-j
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  ludi on Sun Jan 18, 2009 10:43 am

Hi,
i think that's a good idea! I will try it.

Thanks

ludi

Posts : 14
Join date : 2008-10-19

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  meteors on Sun Jan 18, 2009 12:25 pm

anytime :-)


-j
avatar
meteors

Posts : 241
Join date : 2008-11-08
Location : Sunny Florida

View user profile

Back to top Go down

Re: Increase hit region of an object

Post  Sponsored content


Sponsored content


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