_SIO2objectphysic->_btRigidBody

View previous topic View next topic Go down

_SIO2objectphysic->_btRigidBody

Post  manuelmartinf on Sun Sep 13, 2009 11:58 am

Hi,

I'm a newby iphone developer from Spain (and I'm sorry about my bad english Sad

I've created a Rigid Body sphere (named SphereObject) in blender, but when I want to acces by code...


Code:
   SIO2object *_SIO2SphereObject = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,  SIO2_OBJECT,  "object/SphereObject" );
   if(_SIO2SphereObject)
   {
     sio2Debug("1");
     if( _SIO2SphereObject->_SIO2objectphysic)
     {
         sio2Debug("2");
         if (_SIO2SphereObject->_SIO2objectphysic->_btRigidBody )
         {
           sio2Debug("3");
           _SIO2SphereObject->_SIO2objectphysic->_btRigidBody->setLinearVelocity( btVector3( 10,0,0));
         }
     }
   }

...I can get to sio2Debug("1") and to sio2Debug("2") but I can't get to sio2Debug("3") The member _btRigidBody on _SIO2SphereObject->_SIO2objectphysic->_btRigidBody seems to be null.

How can I get the _btRigidBody loaded?

Thank you very, very much!!!!!

manuelmartinf

Posts : 14
Join date : 2009-09-13

View user profile

Back to top Go down

Re: _SIO2objectphysic->_btRigidBody

Post  IanLinart on Sun Sep 13, 2009 12:21 pm

you must activate is state

_SIO2SphereObject->_SIO2objectphysic->_btRigidBody->setActivationState( ACTIVE_TAG );


check out tutorial 6 to see

Comments from tut 6

// Activate the state of the rigid body, in case the camera
// didn't move for a while. This is necessary in order to
// apply the linear velocity. Objects that are "sleeping" cannot
// receive no new physic "inputs".
avatar
IanLinart

Posts : 26
Join date : 2009-08-12
Age : 29
Location : Montréal

View user profile http://iapps.linart.qc.ca

Back to top Go down

Re: _SIO2objectphysic->_btRigidBody

Post  Francescu on Sun Sep 13, 2009 12:22 pm

Have you set / marked the sphere as a rigid body in Blender (logic panel)...?

Check tutorial06 blend file and tutorial videos.

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: Re: _SIO2objectphysic->_btRigidBody

Post  manuelmartinf on Sun Sep 13, 2009 1:28 pm

Thank you for all the suggestions!

But...

To IanLinart: I can't activate his state (_SIO2SphereObject->_SIO2objectphysic->_btRigidBody->setActivationState( ACTIVE_TAG )) because I can't access to the _btRigidBody (It seems to be null)

To Francescu: Yes, I have marked the sphere as a Rigid Body in Blender

Any more ideas?

and thank you, thank you, thank you Smile

manuelmartinf

Posts : 14
Join date : 2009-09-13

View user profile

Back to top Go down

Re: _SIO2objectphysic->_btRigidBody

Post  Francescu on Sun Sep 13, 2009 2:34 pm

Do you have all this logic before calling sio2ResourceBindAllPhysicObjects() by any chance?

If yes, that would explain why as the object would not be bound to a physic object yet.

Francescu

Posts : 136
Join date : 2009-03-18

View user profile

Back to top Go down

Re: _SIO2objectphysic->_btRigidBody

Post  manuelmartinf on Mon Sep 14, 2009 4:13 am

Solved!!!

Thank you very much, Francescu, I have called to sio2ResourceBindAllPhysicObjects erroneously

manuelmartinf

Posts : 14
Join date : 2009-09-13

View user profile

Back to top Go down

Re: _SIO2objectphysic->_btRigidBody

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top


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