NickHardeman / ofxBullet

Bullet Physics Wrapper for Openframeworks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Quaternion problem at create function of shapes

dotchang opened this issue · comments

I think,
tr.setRotation( btQuaternion(btVector3(a_rot.x(), a_rot.y(), a_rot.z()), a_rot.w()) );
is not quaternion, it is axis-angle representation.
Maybe,
tr.setRotation(btQuaternion(a_rot.x(), a_rot.y(), a_rot.z(), a_rot.w()) );
is correct. Could you please check?

for example.
void ofxBulletCylinder::create( btDiscreteDynamicsWorld* a_world, ofVec3f a_loc, ofQuaternion a_rot, float a_mass, float a_radius, float a_height ) {
btTransform tr = ofGetBtTransformFromVec3f( a_loc );
//tr.setRotation( btQuaternion(btVector3(a_rot.x(), a_rot.y(), a_rot.z()), a_rot.w()) );
tr.setRotation( btQuaternion(a_rot.x(), a_rot.y(), a_rot.z(), a_rot.w()) );
}

That makes sense. I am planning to review and update the add-on to comply with the new release of OF and the recent switch in vector math to now use glm.

Hello @dotchang, I recently updated the src with your suggestion and converted the math to glm and works properly with OF 0.10. However, I am still working on VS2017 compatibility.