FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Resetting object position

2 posters

Go down

Resetting object position Empty Resetting object position

Post  CadetCrusher Sun Oct 18, 2009 3:01 pm

What is the best way to reset an object's position? For example, when a ball goes out of the play area I'd like to move it back to it's starting position. I've tried setting the _SIO2transform->loc vector of the object then calling sio2TransformBindMatrix(), but that doesn't work. The object is a physics object, BTW.

CadetCrusher

Posts : 21
Join date : 2009-10-07

Back to top Go down

Resetting object position Empty Re: Resetting object position

Post  CadetCrusher Sun Oct 18, 2009 3:10 pm

Ok, so I can now reset the object's position, but the physics simulation won't re-enable. Here's what I'm doing:

Code:

theBall->_SIO2objectphysic->_btRigidBody->setActivationState(DISABLE_SIMULATION);
         
theBall->_SIO2transform->loc->y = -7.967f;
theBall->_SIO2transform->loc->x = 21.383f;
theBall->_SIO2transform->loc->z = 0.598f;
sio2TransformBindMatrix(theBall->_SIO2transform);
         
theBall->_SIO2objectphysic->_btRigidBody->setActivationState(ACTIVE_TAG);

Am I disabling/enabling physics incorrectly?

Thanks!

CadetCrusher

Posts : 21
Join date : 2009-10-07

Back to top Go down

Resetting object position Empty Re: Resetting object position

Post  sio2interactive Sun Oct 18, 2009 3:44 pm

_SIO2object->_SIO2objectphysic->_btRigidBody->getWorldTransform().setFromOpenGLMatrix( _SIO2object->_SIO2transform->mat );
sio2interactive
sio2interactive

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

http://sio2interactive.com

Back to top Go down

Resetting object position Empty Re: Resetting object position

Post  CadetCrusher Sun Oct 18, 2009 9:15 pm

Works great! Thanks. Very Happy

CadetCrusher

Posts : 21
Join date : 2009-10-07

Back to top Go down

Resetting object position Empty Re: Resetting object position

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top


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