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.

Tutorial#2 - Custom model doesn't respond to touch input

2 posters

Go down

Tutorial#2 - Custom model doesn't respond to touch input Empty Tutorial#2 - Custom model doesn't respond to touch input

Post  teh1ghool Tue Oct 27, 2009 4:07 pm

Hey guys. I've just gotten started with SIO2 and I decided to see how easy it would be to input a custom model into the game. I chose the template for tutorial2 and compiled it. Great, works just like it should. I then created a simple model and followed the instructions on adding it to tutorial2. It imported without any problems, however it would not respond to the touch input. I figure I simply forgot a small step. I checked over the code and didn't see anything that indicated specific naming of the model be required, other than tutorial02.sio2. Assistance much appreciated.

teh1ghool

Posts : 5
Join date : 2009-10-27

Back to top Go down

Tutorial#2 - Custom model doesn't respond to touch input Empty Re: Tutorial#2 - Custom model doesn't respond to touch input

Post  sio2interactive Tue Oct 27, 2009 4:11 pm

Check in template.cc inside the touch move event callback:

Code:


void templateScreenTouchMove( void *_ptr )
{
   if( sio2->_SIO2window->n_touch )
   {
      float d = sio2->_SIO2window->touch[ 0 ]->x - start.x;
      
      // Get the object name "Suzanne" located inside our resources.
      // Please take note that there is similar funtion for all
      // type of resources that SIO2 support ex: GetImage, GetMaterial
      // etc... So you can get access directly to any type
      // of handle within an SIO2resource.
      SIO2object *_SIO2object = ( SIO2object * )sio2ResourceGetObject( sio2->_SIO2resource,
                                                       "object/Suzanne" );
      // Check if we get a pointer.
      if( _SIO2object )
      {
         // Apply a rotation based on the
         // touch movement. (basic)
         if( d > 5.0f || d < -5.0f )
         { _SIO2object->_SIO2transform->rot->z += ( d * 0.025f ); }
         
         // Update the OpenGL matrix and apply the
         // new rotation specified above.
         sio2TransformBindMatrix( _SIO2object->_SIO2transform );
      }
   }
}

sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

Tutorial#2 - Custom model doesn't respond to touch input Empty Re: Tutorial#2 - Custom model doesn't respond to touch input

Post  teh1ghool Tue Oct 27, 2009 4:19 pm

Much thanks. That was rather obvious.

teh1ghool

Posts : 5
Join date : 2009-10-27

Back to top Go down

Tutorial#2 - Custom model doesn't respond to touch input Empty Re: Tutorial#2 - Custom model doesn't respond to touch input

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

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