rotate a physics object?
2 posters
rotate a physics object?
I'm trying to duplicate - and then both scale and rotate a "static" physics object with box bounds.
(The larger scale goal is to define some basic objects in blender - then programatically create a new scene using them)
The following code seems to work for me as far as scaling the duplicate object:
But whenever I try to introduce rotation - I get strange results. It seems I can get the rotation - or the scaling to work in physics - but not both.
Is there a "right" way to do this? Am I barking up the wrong tree? Any help appreciated.
Currently using sio2 1.35.
(The larger scale goal is to define some basic objects in blender - then programatically create a new scene using them)
The following code seems to work for me as far as scaling the duplicate object:
- Code:
SIO2object *selection = ( SIO2object * )sio2ResourceGet( sio2->_SIO2resource,
SIO2_OBJECT,
"object/floor1" );
selection->_SIO2transform->loc->x += 180.0f;
selection->_SIO2transform->scl->x = .6f;
btRigidBody *_btRigidBody;
btCollisionShape *_btCollisionShape;
btDefaultMotionState *_btDefaultMotionState;
btTransform _btTransform;
btMatrix3x3 _btMatrix3x3;
btVector3 inertia( 0.0, 0.0, 0.0 );
_btCollisionShape = new btBoxShape( btVector3( selection->dim->x * selection->_SIO2transform->scl->x,
selection->dim->y * selection->_SIO2transform->scl->y,
selection->dim->z * selection->_SIO2transform->scl->z ) );
_btTransform.setIdentity();
_btTransform.setOrigin( btVector3( selection->_SIO2transform->loc->x,
selection->_SIO2transform->loc->y,
selection->_SIO2transform->loc->z ) );
_btDefaultMotionState = new btDefaultMotionState( _btTransform );
_btCollisionShape->calculateLocalInertia( (btScalar)selection->mass, inertia );
_btRigidBody = new btRigidBody( (btScalar)selection->mass,
_btDefaultMotionState,
_btCollisionShape,
inertia );
_btRigidBody->setAngularFactor( (btScalar)0.0 );
sio2->_SIO2physic->_btSoftRigidDynamicsWorld->addRigidBody( _btRigidBody );
selection->_btRigidBody = _btRigidBody;
selection = sio2ObjectDuplicate( selection,
selection->_SIO2transform,
new_object, 1 );
But whenever I try to introduce rotation - I get strange results. It seems I can get the rotation - or the scaling to work in physics - but not both.
Is there a "right" way to do this? Am I barking up the wrong tree? Any help appreciated.
Currently using sio2 1.35.
arrogantb- Posts : 5
Join date : 2009-02-05
Similar topics
» physics object inside another physics object
» how to not rotate around object
» Rotate the camera instead of the object...
» Rotate object through global axis
» How to rotate a object without changing the axis by SIO2?
» how to not rotate around object
» Rotate the camera instead of the object...
» Rotate object through global axis
» How to rotate a object without changing the axis by SIO2?
Permissions in this forum:
You cannot reply to topics in this forum