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.

Congratulating the 1.3.1 version

4 posters

Go down

Congratulating the 1.3.1 version Empty Congratulating the 1.3.1 version

Post  sw Tue Dec 09, 2008 8:13 am

first Congratulate sio2interactive released the new vesion. it is very cool to support softbody , and mix 2D and 3D screen.
the and sio2 physic bullet engine upgraded to 2.7.3 , i like it very much Smile and helps us so much .

after upgrading our game project to the new version i found some burr in the new version
first ,
void sio2PhysicRemoveObject ( //....
{ //......

else if( _btSoftBody == _SIO2object->_btSoftBody ) /// this will crash, because NULL==NULL
//.....
}


the second , my Dynamic Object will NOT fall down to the earth , and I can't move it by setLinearVelocity , i did not know why , i will check it.

and , the new version did not support muilt-touch, I post some code i am using

Code:


[self setMultipleTouchEnabled:YES] ;




Code:



- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
   UITouch *touch;
   CGPoint pos;
   
   //sio2WindowResetTouch( sio2->_SIO2window );

   for( touch in touches )
   {
      pos = [ touch locationInView:self ];
         
      sio2WindowAddTouch( sio2->_SIO2window,
                     pos.x,
                     pos.y );
   }

   sio2->_SIO2window->n_tap = [ [ touches anyObject ] tapCount ];
   
   sio2ResourceDispatchEvents( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        SIO2_WINDOW_TAP,
                        SIO2_WINDOW_TAP_DOWN );   
}


- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event  //// hanzhicai add
{
   UITouch *touch;
   CGPoint pos;
   
   //sio2WindowResetTouch( sio2->_SIO2window );

   for( touch in touches )
   {
      pos = [ touch locationInView:self ];
         
      sio2WindowMovingTouch ( sio2->_SIO2window,
                       pos.x,
                       pos.y );
      
      //sio2WindowAddTouch( sio2->_SIO2window,
      //               pos.x,
      //               pos.y );
   }

   
   sio2ResourceDispatchEvents( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        SIO2_WINDOW_TOUCH_MOVE,
                        SIO2_WINDOW_TAP_DOWN );
}


- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event  //// hanzhicai add
{
   
   UITouch *touch;
   CGPoint pos;
   
   //sio2WindowResetTouch( sio2->_SIO2window );
   
   for( touch in touches )
   {
      pos = [ touch locationInView:self ];
      
      sio2WindowRemoveTouch ( sio2->_SIO2window,
                       pos.x,
                       pos.y );

   }
   
   sio2ResourceDispatchEvents( sio2->_SIO2resource,
                        sio2->_SIO2window,
                        SIO2_WINDOW_TAP,
                       SIO2_WINDOW_TAP_UP );

//   sio2WindowResetTouch( sio2->_SIO2window );

   sio2->_SIO2window->n_tap = [ [ touches anyObject ] tapCount ];
}



and add the following code :


Code:



void sio2WindowRemoveTouch( SIO2window *_SIO2window,   
                    float       _x,
                    float       _y )
{
   float point2point =500;
   int repoint ;
   _y= _SIO2window->size->y - _y ;
   for (int i=0; i<  _SIO2window->n_touch ; i++ ) 
   {
      
      float tmp_x = _SIO2window->touch[ i ]->x - _x ;
      float tmp_y = _SIO2window->touch[ i ]->y - _y ;
      float tmp_dis = sqrt((double)(tmp_x*tmp_x + tmp_y*tmp_y ));
      if ( tmp_dis < point2point && tmp_dis <20.0 )  /// the max moving speed set to 20.0 units
      {
         repoint=i;
         point2point = tmp_dis;
         
      }
   }
   for (int j = repoint+1 ; j < _SIO2window->n_touch ; j++)
   {
      _SIO2window->touch[ j - 1 ]->x = _SIO2window->touch[ j  ]->x ;
      _SIO2window->touch[ j - 1 ]->y = _SIO2window->touch[ j  ]->y ;
      
   }
   
   _SIO2window->touch[ _SIO2window->n_touch-1 ] = sio2Vec2Free( _SIO2window->touch[ _SIO2window->n_touch -1 ] );
   _SIO2window->n_touch--;
   
   
}


void sio2WindowMovingTouch( SIO2window *_SIO2window,  //// hanzhicai add
                    float       _x,
                    float       _y )
{
   float point2point =500;
   int repoint =100  ;
   _y= _SIO2window->size->y - _y ; 
   for (int i=0; i<  _SIO2window->n_touch ; i++ )
   {
      
      float tmp_x = _SIO2window->touch[ i ]->x - _x ;
      float tmp_y = _SIO2window->touch[ i ]->y - _y ;
      float tmp_dis = sqrt((double)(tmp_x*tmp_x + tmp_y*tmp_y ));
      if ( tmp_dis < point2point && tmp_dis <20.0 )  /// the max moving speed set to 20.0 units
      {
         repoint=i;
         point2point = tmp_dis;
         
      }
      
      
   }
   if (_SIO2window->n_touch > repoint)
   {
      _SIO2window->touch[ repoint ]->x = _x;
      _SIO2window->touch[ repoint ]->y = _y ; 
   }
   
   
}



hope it is useful.
sw
sw

Posts : 73
Join date : 2008-10-12

Back to top Go down

Congratulating the 1.3.1 version Empty Re: Congratulating the 1.3.1 version

Post  uprise78 Tue Dec 09, 2008 11:07 am

The multitouch code looks good. I have been meaning to write that for a long time but hadn't gotten around to it. Thanks.

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

Congratulating the 1.3.1 version Empty Re: Congratulating the 1.3.1 version

Post  sio2interactive Tue Dec 09, 2008 4:38 pm

Add this in the sio2PhysicRemoveObject function:

Code:


   if( !_SIO2object->_btRigidBody && !_SIO2object->_btSoftBody )
   { return; }


the new version did not support muilt-touch

>> Hummm dude check tutorial05... And by the way no need to remap the touches the array sequence will always be from first to last...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Congratulating the 1.3.1 version Empty Object not moving after update

Post  jlperan Wed Dec 10, 2008 9:48 am

I´m having a problem with the new version.

I have an object and I apply an impulse to it with this code:

Code:
_Object->_btRigidBody->setActivationState(DISABLE_DEACTIVATION);
_Object->_btRigidBody->applyImpulse(_impulse, _rel_pos);
sio2ObjectBindMatrix(_Object);

That was working with 1.2.1 but after the update the object keeps in place. I´ve been looking at the new examples but I don´t see any different. Neutral

Help appreciated. Thanks.

jlperan

Posts : 41
Join date : 2008-10-10

Back to top Go down

Congratulating the 1.3.1 version Empty Re: Congratulating the 1.3.1 version

Post  sio2interactive Wed Dec 10, 2008 4:50 pm

Code:


!_SIO2object->_btRigidBody->isStaticObject() &&
              _SIO2object->_btRigidBody->getActivationState() == ACTIVE_TAG


This is the code that is evaluated in order to update the rigid body object matrix...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Congratulating the 1.3.1 version Empty Re: Congratulating the 1.3.1 version

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