_SIO2parent child movement problem.

View previous topic View next topic Go down

_SIO2parent child movement problem.

Post  Fish on Fri Jul 10, 2009 5:48 am

Hi,

I have come across a problem when trying to move a parent object: the child disappears when the parent moves out of a certain range.

I have taken tutorial 9 as a basis. I have set the coordinates of the player and peacock objects to 0,0,0 then 'centered new' both of them.

I then attach the peacock object as a child to the player object

ie-
SIO2object *objectPlayer= ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, "object/player");

SIO2object *objectPeacock = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource, SIO2_OBJECT, "object/peacock" ); // Get the handle of our "player" entity.

objectPeacock->_SIO2transform->_SIO2parent = objectPlayer->_SIO2transform;
sio2TransformBindMatrix(objectPeacock->_SIO2transform);

The peacock object now follows the player object as expected. This works until the player object reaches a certain distance away and then the peacock object will no longer appear. I presume it has somehow 'gone out of range' and is no longer drawn.

Has anyone else come across this problem and found a solution?

Thanks,
Paul

Fish

Posts : 9
Join date : 2009-04-30

View user profile

Back to top Go down

Re: _SIO2parent child movement problem.

Post  sio2interactive on Fri Jul 10, 2009 3:02 pm

No it is caused by the clipping... you need to update the child _SIO2transform->loc to be in world coordinates and use the matrix as the relative coordinate.

_________________
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: _SIO2parent child movement problem.

Post  Fish on Mon Jul 13, 2009 9:21 am

Thanks for the quick reply; that solved the problem!

Thanks,
Fish

Fish

Posts : 9
Join date : 2009-04-30

View user profile

Back to top Go down

Re: _SIO2parent child movement problem.

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