model disappears when doing sio2ObjectSoftCopy

View previous topic View next topic Go down

model disappears when doing sio2ObjectSoftCopy

Post  bwalker on Mon Aug 03, 2009 1:32 pm

So I integrated tutorial 61's example code for sio2ObjectSoftCopy. I'm copying a cube that resides in the .sio2 file and adjusting its x/y before displaying the copy. Most of the time this works fine, but quite often the original cube randomly disappears (and the new one doesn't appear either). I tried sio2ObjectHardCopy and the same behavior occurred.

Here's the relevant code:
Code:

SIO2object *_original = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/Cube" );

if (_original) {      
   //NSLog ( @"found obj to duplicate %");
   
   static unsigned int i = 0;
   char tmp_name[ SIO2_MAX_CHAR ] = {""};
   sprintf( tmp_name, "%s%d", _original->name, i );
   
   SIO2object *_new = sio2ObjectHardCopy(_original, tmp_name);
   
   _original->_SIO2transform->loc->x = x;
   _original->_SIO2transform->loc->y = y;
   _original->_SIO2transform->loc->z = 0.0f;
   
   sio2TransformCopy( _new->_SIO2transform,
                     _original->_SIO2transform );
      
   sio2TransformBindMatrix( _new->_SIO2transform );

}

bwalker

Posts : 10
Join date : 2009-07-28

View user profile

Back to top Go down

Re: model disappears when doing sio2ObjectSoftCopy

Post  sio2interactive on Mon Aug 03, 2009 3:22 pm

Does the pivot point of your model in centered?

_________________
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 : 37
Location : Shanghai

View user profile http://sio2interactive.com

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