Resetting object position
2 posters
Resetting object position
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
Re: Resetting object position
Ok, so I can now reset the object's position, but the physics simulation won't re-enable. Here's what I'm doing:
Am I disabling/enabling physics incorrectly?
Thanks!
- 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
Re: Resetting object position
_SIO2object->_SIO2objectphysic->_btRigidBody->getWorldTransform().setFromOpenGLMatrix( _SIO2object->_SIO2transform->mat );
Permissions in this forum:
You cannot reply to topics in this forum
|
|