Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

How to rotate and translate a ofxBullet body?

$
0
0

Hi,

I am trying to understand how to rotate some boxes I am creating from default "vertical position". Can I create the boxes on the rotation position I like? Or must I make the rotation after the creation like its explained above here?

Also, it's the center of the box the position taken as point?

    boxVector = pointTo - pointFrom; // botton to top side of the box
    groundQuat = ofQuaternion(boxVector.x, boxVector.y, boxVector.z, 0); // ?
//            groundQuat = ofQuaternion(0., 0., 1., 0);
//            groundQuat = ofQuaternion(1., 0., 0., 0);
//            groundQuat = ofQuaternion(0., 1., 0., 0); 
    ((ofxBulletBox*)boxes[boxes.size()-1])->create( world.world, boxCenter, groundQuat, 0.5, boxSizeX, boxSizeY, boxSizeZ);
    boxes[boxes.size()-1]->add();

I can't understand how to do it. I don't understand how to use the Quaternion and where to start to read... I am very lost as you can see....

Should I use one quaternion for each of the 3 axis and make his own degree rotation?

(There's some // in degress // section on ofxBulletUtils.h but it's commented and not implemented)


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>