简体   繁体   中英

Bullet - RigidBody Initial Rotation/Translation

I've been looking online for a good amount of time and can't seem to find the solution to my problem. The problem is that I can't find a way to set the initial rotation and translation for a RigidBody when the scene starts. Could someone tell me where I can find the answer, or show me? Any help would be appreciated!

As you can guess, there are a lot of documents about this in the internet, but they often lack documents or misleading.

Here is the set-transformation function (I tested):-

// `body` is `btRigidBody*` 
btTransform transform = body -> getCenterOfMassTransform();
transform.setOrigin(new_position);               //set position
//transform.setBasis(const btMatrix3x3& basis)   //set orientation
body -> setCenterOfMassTransform(transform);  

Recommend reading: http://bulletphysics.org/Bullet/BulletFull/classbtTransform.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM