Passing Through Static Object (Beating my iPod seems to help)

View previous topic View next topic Go down

Passing Through Static Object (Beating my iPod seems to help)

Post  freakTheMighty on Sun Mar 29, 2009 7:16 pm

I am trying to setup of a game that controls a rolling ball by tilting. I am programmatically achieving this by simply using the accelerometer values (times 10) as gravity's vector .

When I first got the physics working its seemed to work periodically. 5 out of 10 times the ball would fall through the floor (a static object) and the rest it would hit and roll around correctly. After some experimentation I found that if I gave my iPod a hardy smack the ball wouldn't penetrate (or at least was much less likely to).

I then decided that my scale was much to large. The floor was 7 units away (I believe in bullet this would be meters), and I would like to see the effect of quickly moving the ipod down (creating zero gs) so I need the world to be closer to centimeters in size. Now the ball always penetrates the floor, NO matter how hard I smack my ipod Razz (I think the smacking thing needs to be resolved before giving this to other gamers).

I've removed the dynamic gravity controls, but that didn't fix it. I noticed that when starting the physics engine Mr. SIO2 lowers the fps to 15, I wonder if due to how close the ball is to the floor the engine doesn't have time to calculate the collision. However, changing this number doesn't solve the problem either.

Does anyone have any ideas?

Many thanks,
Jesse

freakTheMighty

Posts : 12
Join date : 2009-03-05

View user profile

Back to top Go down

Re: Passing Through Static Object (Beating my iPod seems to help)

Post  sio2interactive on Sun Mar 29, 2009 7:21 pm

Do multiple FULL pass like that (the FULL pass have been added in 1.3.5):


sio2PhysicRender( sio2->_SIO2physic,
sio2->_SIO2window->d_time, 2 );


which basically does this:

Code:


void sio2PhysicRender( SIO2physic *_SIO2physic,
                 float     _timestep,
                 int        _pass )
{
   unsigned int i = 0;
   
   if( _SIO2physic->state == SIO2_PHYSIC_PLAY )
   {
      float sub = _timestep / ( float )_pass;

      while( i != _pass )
      {
         _SIO2physic->_btSoftRigidDynamicsWorld->stepSimulation( sub, 0 );
         ++i;
      }
   }
}


_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

EXC_BAD_ACCESS

Post  freakTheMighty on Sun Mar 29, 2009 8:50 pm

I updated to 1.3.5 and my program is breaking out with an EXC_BAD_ACCESS error. I've run across this before when I tried to load an object into sio2->_SIO2object, to then add to my physics world. I fixed it by loading it into a local SIO2object instead. This no longer works. And if I don't add it to the physic world my screen draws black . . . (though I don't see you adding your cubes in tutorial 6_1 to a physic world).

I can see there is some structural thing I'm not understanding with SIO2 so debugging for a bad_access error is quite difficult. Any pointers?

freakTheMighty

Posts : 12
Join date : 2009-03-05

View user profile

Back to top Go down

Re: Passing Through Static Object (Beating my iPod seems to help)

Post  sio2interactive on Sun Mar 29, 2009 9:07 pm

http://sio2interactive.com/HOME/Entries/2009/3/27_Important_FIX_on_1.3.5.html

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

same problem

Post  freakTheMighty on Sun Mar 29, 2009 9:30 pm

I'm still getting the same error when trying to add a physic object to the world or alternatively a black screen when I avoid the kind of calls that cause the error.

freakTheMighty

Posts : 12
Join date : 2009-03-05

View user profile

Back to top Go down

Re: Passing Through Static Object (Beating my iPod seems to help)

Post  sio2interactive on Sun Mar 29, 2009 10:06 pm

What type of collision bounds? If its either static triangle mesh or convexhull, you need to call sio2MapBuffer before adding the object to the physic world instead there's no vertices to pass to blender.

If its not one of theses make sure that you have a valid pointer for _SIO2physic & _SIO2object

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Passing Through Static Object (Beating my iPod seems to help)

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