SIO2object->_SIO2objectphysic initialization

View previous topic View next topic Go down

SIO2object->_SIO2objectphysic initialization

Post  mordenkaim on Tue Aug 25, 2009 9:29 pm

I've created physic objects and before I added bounds in blender the program compiled fine and physics objects were duplicating fine.

Now that I added a triangle mesh bound to the parent object in blender and I attempt to duplicate the object it duplicates fine, but when I attempt to run sio2PhysicAddObject on the duplicated object I'm finding that _SIO2object->_SIO2objectphysic->_btRigidBody is not initialized, and searching through tutorial06-* I can't find anything different in the initialization of the physic objects. I'm still familiarizing my self with Bullet so it might be something simple I'm overlooking.

Does anyone know why this might be or know what I might have forgotten?

Thanks in advance Smile

mordenkaim

Posts : 21
Join date : 2009-05-19

View user profile

Back to top Go down

Re: SIO2object->_SIO2objectphysic initialization

Post  sio2interactive on Tue Aug 25, 2009 9:33 pm

Check tutorial061 for duplication... depending on the bound type you might need to map the vertex buffer of the object (like for convexhull or trianglemesh)...

_________________
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: SIO2object->_SIO2objectphysic initialization

Post  mordenkaim on Tue Aug 25, 2009 11:02 pm

Based on the comments in tut061 it sounds like you only need to use hard copy to have access to the vertices which I'm using.. This is the code that worked prior to adding a trianglemesh bound to the parent object. Once I added it the sio2PhysicAddObject began to throw an EXC_BAD_ACCESS because it was trying to reference a null object. It must be the vertices like you say but I'm not certain what else needs to be done in order to make them accessible. Is there something I'm missing?

Code:

//source is previously defined as a parent SIO2Object
//gameMatrix is a multi dimensional array of SIO2Objects

sprintf(name,"%s_%d_%d",source->name,colInt,rowInt);
gameMatrix[colInt][rowInt]=sio2ObjectHardCopy(source,name); //duplicate
//move the objects to desired location, setting them up in a grid
gameMatrix[colInt][rowInt]->_SIO2transform->loc->x=(colInt-(numCols/2))*(source->rad * 1.5f);
gameMatrix[colInt][rowInt]->_SIO2transform->loc->z=(rowInt-(numRows/2))*(source->rad * 1.5f);
sio2TransformBindMatrix(gameMatrix[colInt][rowInt]->_SIO2transform);
//move complete, now add it as a physic object
if( gameMatrix[colInt][rowInt]->_SIO2objectphysic->bounds == SIO2_PHYSIC_TRIANGLEMESH )
   sio2PhysicAddObject(sio2->_SIO2physic,gameMatrix[colInt][rowInt]);


mordenkaim

Posts : 21
Join date : 2009-05-19

View user profile

Back to top Go down

Re: SIO2object->_SIO2objectphysic initialization

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