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.

Physics Slowing Animation

4 posters

Go down

Physics Slowing Animation Empty Physics Slowing Animation

Post  jj Mon Sep 29, 2008 10:25 pm

Hi, thanks for all your insight.

I decided to start over with a simple simulation from scratch to get a hold of the frame rate independence issue.

I've got a nice, smooth, and "real-time" simulation going now. My issue is:

When the object starts colliding with the ghost, and "rattling" around inside the concave box, the animation starts getting choppy and running slow. I imagine this is the limitation of the iPhone and CPU.

What is the correct way to compensate for this?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Mon Sep 29, 2008 11:14 pm

The physic simulation is the most computation intensive operations in SIO2 (even more than actually rendering, from what I observe), thats why I had to tweak the parameters a bit in SIO2 (check out other post on this forum). My receipe is the following:

For the simulation step:

1. Instead of using the real delta time im using 1 / fps, thats why Im suggesting to tweak the fps after loading in tutorial06 etc...

2. For the simulation steps im using 0

By doing this you can add a few more objects into your scene without actually slowing it down...

Using the "normal" simulation setting with the delta time & like 4 steps its way to slow on the iphone when you start having too many objects.

If anyone have other suggestion to speed up bullet in SIO2 in all hears Wink

Cheers,
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  jj Tue Sep 30, 2008 12:18 am

quick ?:

Is there a way for me to tell the current speed of the animation drawing fps. For example, I'll be able to see as it dips when the collisions start occuring?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Tue Sep 30, 2008 12:28 am

You can get the fps with:

sio2->_SIO2window->fps

and the delta time (what was the time to render 1 frame ) with

sio2->_SIO2window->dtime

But Im not really sure what is your question... can you elaborate a bit more?

>> I'll be able to see as it dips when the collisions start occuring?

That part I don't get it sorry...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  jj Tue Sep 30, 2008 12:38 am

That was what I needed. I put a NSLog in my EAGLView.mm drawView method.

However, the fps is always 0.0. What's that about?

Second, when the collisions that slow the CPU begin the d_time goes from .05 up to a max of 3.113...

I take it there's nothing I can do to minimize the effect of this...?
Thanks for thoughts

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Tue Sep 30, 2008 12:56 am

>> However, the fps is always 0.0. What's that about?

Really? are you calling sio2SwapBuffers (yeah I know the name doesnt really represent that this is doing but im from a GLUT background I just cant help it Wink) at the end of your rendering loop?
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  jj Tue Sep 30, 2008 1:14 am

ah, i'm silly. I used

NSLog(@"windowFPS: %f", sio2->_SIO2window->fps);

But its an unsigned char.

How would I log this?

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Tue Sep 30, 2008 1:22 am

hummmm %d??!?!
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  jj Tue Sep 30, 2008 2:16 am

thank you kindly.

Ok, so, in template loading I do the tweak and pass _SIO2window->fps = 15

Then as my game gets going, the fps rounds off at about 20 fps. That must be a result of the CPU, and what my static scene rests at?

Then when a have a physics collision, it dips down to around 2-3 fps. This is when my camera gets slow and animation gets choppy. That's what I meant in previous post about "dipping down" fps on collision detection...After collisions play out, fps ramps slowly back up to 20 fps.

Is there a way to adjust animation interval, window fps, or stepSimulation to compensate for this slow iPhone CPU processing?

Sorry if this is confusing, I'm still fairly new to all this, but just a few tweaks away from having a working prototype

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Tue Sep 30, 2008 4:50 am

What type of collision bound you are using?

Just to let you know that Convex Hull is the most expensive one by far...

Replace your sio2_physic.cc with the following code:


Code:


/*

SIO2 Interactive 3D Engine for iPhone & iPod Touch 3D Engine

Copyright (c) 2008 SIO2 Interactive  http://sio2interactive.com

This software is provided 'as-is', without any express or implied warranty.

In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely,
subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.

If you use this software in a product (either free or commercial), an acknowledgment in the product is required at the introduction of the product
using the official "Powered by" short video ( /SIO2_SDK/src/sio2.ogv approximately 10 seconds ) distributed with the software. Please refer to the
tutorial on how to use sio2Video in your product available in the SIO2_SDK.

2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. You are also invited
to post any modifications done to the SIO2 source, at the following email address: sio2interactive@gmail.com, for review and possible addition to the
SIO2 source tree to make them available to the community and to make SIO2 a better software. But it is not required to do so.

3. This notice may not be removed or altered from any source distribution.

4. You are invited to make donations in order to keep the SIO2 project active as well as to sponsor future development and derived project(s),
maintenance of the website, documentation, code, Apple iPhone Developer License etc... But it is not required to do so.

5. If your product using SIO2 is made available to the public (either free or commercial) you are required to let us know by email (sio2interactive@gmail.com)
the following information:

- The title of your product

- A short description of your product

- A valid URL or screenshot(s) of the product in order for us to put it on our website in order to help you promote your creation(s) as well as promoting the
SIO2 project.


In other words this license means SIO2 can freely be used in any product(s), including free or commercial, as long as the restrictions
above are followed.

If you have any questions or want more information concerning this agreement please send us an email at: sio2interactive@gmail.com

Please take note that all resources used by the SDK comes from other free sources and all copyrights are belongs to their respective owner, and
are used for demonstration purpose only.

Other external libraries can be found in the /SIO2_SDK/src/ directory and their respective license(s), as well as this one, can be found
in the /SIO2_SDK/src/LICENSE/ directory.

*/
#include "sio2.h"

SIO2physic *sio2PhysicInit( char *_name )
{
   SIO2physic *_SIO2physic = ( SIO2physic * ) calloc( 1, sizeof( SIO2physic ) );
   
   strcpy( _SIO2physic->name, _name );
   
   _SIO2physic->_btDefaultCollisionConfiguration = new btSoftBodyRigidBodyCollisionConfiguration();
   _SIO2physic->_btCollisionDispatcher           = new btCollisionDispatcher( _SIO2physic->_btDefaultCollisionConfiguration );
   _SIO2physic->_btBroadphaseInterface           = new btDbvtBroadphase();
   _SIO2physic->_btConstraintSolver           = new btSequentialImpulseConstraintSolver();
   
   _SIO2physic->_btDiscreteDynamicsWorld = new btSoftRigidDynamicsWorld( _SIO2physic->_btCollisionDispatcher,   
                                                        _SIO2physic->_btBroadphaseInterface,
                                                        _SIO2physic->_btConstraintSolver,
                                                        _SIO2physic->_btDefaultCollisionConfiguration );
   gContactAddedCallback = sio2PhysicCollisionCallback;

   sio2ResourceAdd( sio2->_SIO2resource,
                 SIO2_PHYSIC,
                 (void *)_SIO2physic );

   return _SIO2physic;
}


SIO2physic *sio2PhysicFree( SIO2physic *_SIO2physic )
{
   sio2PhysicRemoveAll( _SIO2physic );

   delete _SIO2physic->_btDefaultCollisionConfiguration;
   _SIO2physic->_btDefaultCollisionConfiguration = NULL;
   
   delete _SIO2physic->_btCollisionDispatcher;
   _SIO2physic->_btCollisionDispatcher = NULL;
   
   delete _SIO2physic->_btBroadphaseInterface;
   _SIO2physic->_btBroadphaseInterface = NULL;   
   
   delete _SIO2physic->_btConstraintSolver;
   _SIO2physic->_btConstraintSolver = NULL;   
   
   delete _SIO2physic->_btDiscreteDynamicsWorld;
   _SIO2physic->_btDiscreteDynamicsWorld = NULL;      


   sio2ResourceDel( sio2->_SIO2resource,
                SIO2_PHYSIC,
                (void *)_SIO2physic );


   free( _SIO2physic );

   return NULL;
}


void sio2PhysicAddObject( SIO2physic *_SIO2physic,
                    SIO2object *_SIO2object )
{
   if( sio2IsEnabled( _SIO2object->flags, SIO2_OBJECT_ACTOR ) )
   {
      unsigned int         i = 0;
                  
      int                  v[ 3 ];
      
      SIO2object            *tmp = _SIO2object->_SIO2object ? ( SIO2object * )_SIO2object->_SIO2object : _SIO2object;
      
      btCollisionShape      *_btCollisionShape;
      btRigidBody            *_btRigidBody;
      btDefaultMotionState   *_btDefaultMotionState;

      btTransform            trans;
      btVector3            inertia( 0.0, 0.0, 0.0 );
      
      switch( _SIO2object->bounds )
      {
         case SIO2_PHYSIC_BOX:
         {
            _btCollisionShape = new btBoxShape( btVector3( _SIO2object->dim->x * _SIO2object->scl->x,
                                               _SIO2object->dim->y * _SIO2object->scl->y,
                                               _SIO2object->dim->z * _SIO2object->scl->z ) );
            break;
         }
         
         case SIO2_PHYSIC_SPHERE:
         {
            _btCollisionShape = new btSphereShape( (btScalar)( _SIO2object->rad * 0.60f ) );
            break;
         }
         
         case SIO2_PHYSIC_CYLINDER:
         {
            _btCollisionShape = new btCylinderShapeZ( btVector3( (btScalar)( _SIO2object->rad * 0.60f ),
                                                             _SIO2object->dim->z * _SIO2object->scl->z,
                                                             _SIO2object->dim->z * _SIO2object->scl->z ) );
            break;
         }
         
         case SIO2_PHYSIC_CONE:
         {
            _btCollisionShape = new btConeShapeZ( (btScalar)( _SIO2object->rad * 0.60f ),
                                                  ( _SIO2object->dim->z * _SIO2object->scl->z ) * 2.0f );
            break;
         }
         
         case SIO2_PHYSIC_TRIANGLEMESH:
         {
            unsigned int j,
                      tri_cnt = 0;
         
            btVector3 tri[ 3 ];
            
            btTriangleMesh *_btTriangleMesh = new btTriangleMesh();

            while( i != tmp->n_vertexgroup )
            {
               unsigned int n_ind = tmp->_SIO2vertexgroup[ i ]->n_ind >> 1;

               j = 0;
               while( j != n_ind )
               {
                  memcpy( &v[ 0 ], &tmp->buf[ tmp->_SIO2vertexgroup[ i ]->ind[ j ] * 12 ], 12 );
                  
                  tri[ tri_cnt ][ 0 ] = SIO2_FIXED_TO_FLOAT( v[ 0 ] ) * _SIO2object->scl->x;
                  tri[ tri_cnt ][ 1 ] = SIO2_FIXED_TO_FLOAT( v[ 1 ] ) * _SIO2object->scl->y;
                  tri[ tri_cnt ][ 2 ] = SIO2_FIXED_TO_FLOAT( v[ 2 ] ) * _SIO2object->scl->z;
                  
                  ++tri_cnt;
                  
                  if( tri_cnt == 3 )
                  {
                     _btTriangleMesh->addTriangle( tri[ 0 ],
                                            tri[ 1 ],
                                            tri[ 2 ] );
                     tri_cnt = 0;
                  }               
               
                  ++j;
               }
            
               ++i;
            }
            
            _btCollisionShape = new btBvhTriangleMeshShape( _btTriangleMesh, 1 );
            
            break;
         }
         
         case SIO2_PHYSIC_CONVEXHULL:
         {
            unsigned int n_vert = sio2ObjectGetNVert( tmp );
               
            btPoint3 vert;
            
            btConvexHullShape *_btConvexHullShape = new btConvexHullShape();
            
            _btConvexHullShape->setMargin( (btScalar)0.25 );
            

            while( i != n_vert )
            {
               memcpy( &v, &tmp->buf[ i * 12 ], 12 );
               
               vert[ 0 ] = SIO2_FIXED_TO_FLOAT( v[ 0 ] ) * _SIO2object->scl->x;
               vert[ 1 ] = SIO2_FIXED_TO_FLOAT( v[ 1 ] ) * _SIO2object->scl->y;
               vert[ 2 ] = SIO2_FIXED_TO_FLOAT( v[ 2 ] ) * _SIO2object->scl->z;
               
               _btConvexHullShape->addPoint( vert );
            
               ++i;
            }

            btShapeHull _btShapeHull( _btConvexHullShape );
            _btShapeHull.buildHull( (btScalar)0.01 );
            
            delete _btConvexHullShape;
            
            _btCollisionShape = new btConvexHullShape( (const btScalar *)_btShapeHull.getVertexPointer(), _btShapeHull.numVertices() );
            break;
         }
      }
      
      trans.setFromOpenGLMatrix( ( btScalar * )_SIO2object->mat );

      _btDefaultMotionState = new btDefaultMotionState( trans );
      
      
      if( _SIO2object->mass )
      {         
         _btCollisionShape->calculateLocalInertia( (btScalar)_SIO2object->mass,
                                         inertia );
      }
      
      _btRigidBody = new btRigidBody( (btScalar)_SIO2object->mass,
                                      _btDefaultMotionState,
                                      _btCollisionShape,
                                      inertia );


      if( sio2IsEnabled( _SIO2object->flags, SIO2_OBJECT_DYNAMIC ) )
      {
         if( !sio2IsEnabled( _SIO2object->flags, SIO2_OBJECT_RIGIDBODY ) )
         { _btRigidBody->setAngularFactor( (btScalar)0.0f ); }
         
         _btRigidBody->setDamping( (btScalar)_SIO2object->damp,
                             (btScalar)_SIO2object->rotdamp );
      }
      
      
      if( tmp->n_vertexgroup )
      {
         unsigned int j = 0;
         
         while( j != tmp->n_vertexgroup )
         {
            if( tmp->_SIO2vertexgroup[ j ]->_SIO2material )
            {
               _btRigidBody->setFriction( (btScalar)tmp->_SIO2vertexgroup[ j ]->_SIO2material->friction );
               _btRigidBody->setRestitution( (btScalar)tmp->_SIO2vertexgroup[ j ]->_SIO2material->restitution );
            }
            
            ++j;
         }
      }
   
      _SIO2physic->_btDiscreteDynamicsWorld->addRigidBody( _btRigidBody );
      
      _SIO2object->_btRigidBody = _btRigidBody;
   }
}


void sio2PhysicAddCamera( SIO2physic *_SIO2physic,
                    SIO2camera *_SIO2camera )
{
   btRigidBody            *_btRigidBody;
   btCollisionShape      *_btCollisionShape;
   btDefaultMotionState   *_btDefaultMotionState;
   btTransform             _btTransform;
   btMatrix3x3             _btMatrix3x3;
      
   btVector3             inertia( 0.0, 0.0, 0.0 );

   
   _btCollisionShape = new btCylinderShapeZ( btVector3( _SIO2camera->rad,
                                           0.0f,
                                           _SIO2camera->height ) );
   
   _btTransform.setIdentity();
   
   _btTransform.setOrigin( btVector3( _SIO2camera->pos->x,
                             _SIO2camera->pos->y,
                             _SIO2camera->pos->z ) );
   
   _btDefaultMotionState = new btDefaultMotionState( _btTransform );
   
   _btCollisionShape->calculateLocalInertia( (btScalar)_SIO2camera->mass, inertia );
   
   _btRigidBody = new btRigidBody( (btScalar)_SIO2camera->mass,
                                   _btDefaultMotionState,
                                   _btCollisionShape,
                                   inertia );

   _btRigidBody->setAngularFactor( (btScalar)0.0 );
   
   _btRigidBody->setFriction( (btScalar)_SIO2camera->friction );
   
   _btRigidBody->setRestitution( (btScalar)_SIO2camera->restitution );
   
   _SIO2physic->_btDiscreteDynamicsWorld->addRigidBody( _btRigidBody );
   
   _SIO2camera->_btRigidBody = _btRigidBody;
}


void sio2PhysicRemoveObject( SIO2physic *_SIO2physic,
                      SIO2object *_SIO2object )
{
   int i = 0;

   while( i != _SIO2physic->_btDiscreteDynamicsWorld->getNumCollisionObjects() )
   {
      btCollisionObject *_btCollisionObject = _SIO2physic->_btDiscreteDynamicsWorld->getCollisionObjectArray()[ 0 ];
      btRigidBody *_btRigidBody = btRigidBody::upcast( _btCollisionObject );
      
      if( _btRigidBody == _SIO2object->_btRigidBody )
      {
         delete _btRigidBody->getCollisionShape();
         delete _btRigidBody->getMotionState();
      
         _SIO2physic->_btDiscreteDynamicsWorld->removeRigidBody( _btRigidBody );
      
         delete _btRigidBody;
         _btRigidBody = NULL;
         
         break;
      }
      
      ++i;
   }
}


void sio2PhysicRemoveCamera( SIO2physic *_SIO2physic,
                      SIO2object *_SIO2camera )
{
   int i = 0;

   while( i != _SIO2physic->_btDiscreteDynamicsWorld->getNumCollisionObjects() )
   {
      btCollisionObject *_btCollisionObject = _SIO2physic->_btDiscreteDynamicsWorld->getCollisionObjectArray()[ 0 ];
      btRigidBody *_btRigidBody = btRigidBody::upcast( _btCollisionObject );
      
      if( _btRigidBody == _SIO2camera->_btRigidBody )
      {
         delete _btRigidBody->getCollisionShape();
         delete _btRigidBody->getMotionState();
      
         _SIO2physic->_btDiscreteDynamicsWorld->removeRigidBody( _btRigidBody );
      
         delete _btRigidBody;
         _btRigidBody = NULL;
         
         break;
      }
      
      ++i;
   }
}


void sio2PhysicRemoveAll( SIO2physic *_SIO2physic )
{
   while( _SIO2physic->_btDiscreteDynamicsWorld->getNumCollisionObjects() )
   {
      btCollisionObject *_btCollisionObject = _SIO2physic->_btDiscreteDynamicsWorld->getCollisionObjectArray()[ 0 ];
      btRigidBody *_btRigidBody = btRigidBody::upcast( _btCollisionObject );

      delete _btRigidBody->getCollisionShape();
      delete _btRigidBody->getMotionState();
      
      _SIO2physic->_btDiscreteDynamicsWorld->removeRigidBody( _btRigidBody );
      
      delete _btRigidBody;
      _btRigidBody = NULL;
   }
}


void sio2PhysicSetGravity( SIO2physic *_SIO2physic,
                    vec3        *_grav )
{
   _SIO2physic->_btDiscreteDynamicsWorld->setGravity( btVector3( _grav->x,
                                                  _grav->y,
                                                  _grav->z ) );

}


void sio2PhysicReset( SIO2physic *_SIO2physic )
{
   unsigned int i = 0,
             n_object;
   
   n_object = _SIO2physic->_btDiscreteDynamicsWorld->getNumCollisionObjects();
   
   while( i != n_object )
   {
      btCollisionObject *obj = _SIO2physic->_btDiscreteDynamicsWorld->getCollisionObjectArray()[ i ];
      btRigidBody *body = btRigidBody::upcast( obj );

      if( body )
      {
         if( body->getMotionState() )
         {
            btDefaultMotionState* motion = (btDefaultMotionState*)body->getMotionState();
            motion->m_graphicsWorldTrans = motion->m_startWorldTrans;
            
            obj->setWorldTransform( motion->m_graphicsWorldTrans );
            obj->setInterpolationWorldTransform( motion->m_startWorldTrans );
            obj->activate();
         }
                  
         _SIO2physic->_btDiscreteDynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs( obj->getBroadphaseHandle(),
                                                                                      _SIO2physic->_btDiscreteDynamicsWorld->getDispatcher() );
         
         if( body && !body->isStaticObject() )
         {
            btRigidBody::upcast( obj )->setLinearVelocity ( btVector3( 0, 0, 0 ) );
            btRigidBody::upcast( obj )->setAngularVelocity( btVector3( 0, 0, 0 ) );
         }
      }
      
      ++i;
   }
}


void sio2PhysicPlay( SIO2physic *_SIO2physic )
{ _SIO2physic->state = SIO2_PHYSIC_PLAY; }


void sio2PhysicPause( SIO2physic *_SIO2physic )
{ _SIO2physic->state = SIO2_PHYSIC_PAUSE; }


void sio2PhysicStop( SIO2physic *_SIO2physic )
{
   _SIO2physic->state = SIO2_PHYSIC_STOP;
   
   sio2PhysicReset( _SIO2physic );
}


bool sio2PhysicCollisionCallback( btManifoldPoint &cp,
                          const btCollisionObject* colObj0,int partId0, int index0,
                          const btCollisionObject* colObj1,int partId1, int index1 )
{
   unsigned int i = 0;
   
   while( i != sio2->_SIO2resource->n_sensor )
   {
      SIO2sensor *_SIO2sensor = ( SIO2sensor * )sio2->_SIO2resource->_SIO2sensor[ i ];
   
      if( _SIO2sensor->_SIO2sensorcollision )
      {
         if( ( _SIO2sensor->_SIO2object0->_btRigidBody == btRigidBody::upcast( colObj0 ) ||
              _SIO2sensor->_SIO2object0->_btRigidBody == btRigidBody::upcast( colObj1 ) )
              &&
            ( _SIO2sensor->_SIO2object1->_btRigidBody == btRigidBody::upcast( colObj0 ) ||
              _SIO2sensor->_SIO2object1->_btRigidBody == btRigidBody::upcast( colObj1 ) ) )
         { _SIO2sensor->_SIO2sensorcollision( _SIO2sensor ); }
      }
   
      ++i;
   }

   return false;
}


void sio2PhysicRender( SIO2physic *_SIO2physic,
                 SIO2window *_SIO2window )
{
   if( _SIO2physic->state == SIO2_PHYSIC_PLAY )
   { _SIO2physic->_btDiscreteDynamicsWorld->stepSimulation( (btScalar)( 1.0f / _SIO2window->fps ), 0 ); }
}



That should give you a little boost on the convex hull shape as well as on the broadphase interface, this file is not yet part of the current release but it is stable so far Wink

Lemme know if it help
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  jj Thu Oct 02, 2008 4:05 am

I get an error here:

'btShapeHull' was not declared in this scope
'_btShapeHull' was not declared in this scope

btShapeHull _btShapeHull( _btConvexHullShape );

jj

Posts : 77
Join date : 2008-09-24

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Thu Oct 02, 2008 6:15 am

Ho sorry my bad I forgot to mention to #include "../bullet/btShapeHull.h" in sio2.h

Like this:

#define USE_APPROXIMATION 1
#include "../bullet/btBulletDynamicsCommon.h"
#include "../bullet/btSoftRigidDynamicsWorld.h"
#include "../bullet/btShapeHull.h"
#include "../bullet/btSoftBodyRigidBodyCollisionConfiguration.h"
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  matt Sun Nov 02, 2008 7:53 am

I'm experiencing the same problem. I'm dropping some boxes (5-6) (with bounds SIO2_PHYSIC_BOX) on a plane. FPS are ok until the boxes hit the ground, but then FPS drop massively on the device.

Moreover, I'm experiencing the following effect: although I'm using a very low gravity for debugging purposes, objects start falling very quick. Somethings too quick so that they jump right through the plane. After about half of the way they fall slower. I followed your advice to set the fps to some value like 15 or 30 for the first frame, but it doesn't really help.

I'm using the version you kindly provided for the point sprite particle system.

Any help appreciated.

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Sun Nov 02, 2008 4:09 pm

Theses are more Bullets issues... However, in the next revision Im planning to move all the Bullet physic calculation (as well as visibility & sorting) to another thread in order to improve the performances. I just found out not so long ago that the multithread support of Bullet doesn't work on Mac OS (same for the device)... So I have to use another approach that will move all the physic call into a separate callback... In the meantime maybe give a shot to the Bullet forum to address theses issues and check if someone have a fix to make it faster.

Keep me posted,

Cheers,
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  matt Sun Nov 02, 2008 4:12 pm

sio2interactive wrote:However, in the next revision Im planning to move all the Bullet physic calculation (as well as visibility & sorting) to another thread in order to improve the performances.
Sounds interesting. Any idea when this will be?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Sun Nov 02, 2008 4:22 pm

Well In about 2 weeks or so, Im going to release that among with other improvements, fixed and some new functionalities.
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  matt Sun Nov 02, 2008 6:40 pm

sio2interactive wrote:Well In about 2 weeks or so, Im going to release that among with other improvements, fixed and some new functionalities.
Hm, well, I could really need the new sensor and I could need some more speed for physics as well. So if you have something available just PM me, I'll happily beta-test it ;-)

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Sun Nov 02, 2008 7:06 pm

Allright, will keep you posted Wink

Tks matt!
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Mon Nov 03, 2008 4:52 pm

Checkout the file below, I include a version with thread & without:

http://www.sio2interactive.com/dump/physic_thread.zip

Im actually disappointed by the performance... If someone have a better idea how to speed up the physic please do tell...


Last edited by sio2interactive on Wed Nov 05, 2008 1:24 am; edited 1 time in total
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  matt Mon Nov 03, 2008 4:58 pm

Disappointed means...? No change? Improvement, but not as much as expected?

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Mon Nov 03, 2008 5:12 pm

Not as expected... check it out... tell me if you have a better idea...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  gtmacdonald Sun Dec 21, 2008 12:27 am

Hi,

The Oolong folks have some matrix math routines implemented using simd assembly code. They were talking about replacing Bullet's math routines with those implementations. I thought I'd mention it in case a similar approach might help with your performance issues.

-Greg

gtmacdonald

Posts : 9
Join date : 2008-12-11

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

Post  sio2interactive Sun Dec 21, 2008 3:04 am

well check out tutorial 06_1 that should give you a good overview of how it's done...
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Physics Slowing Animation Empty Re: Physics Slowing Animation

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