How to make world space rotations?

How to make world space rotations?

 Hi,

I have two objects that i need to rotate around a point exactly between them.

let's say that the objects are 2 boxes with 0.5f half extents, positioned in:  box1:[1,0,0]  box2:[3,0,0]

the point in between them would be: [2,0,0]

so, after applying a rotation of 90 degrees in the middle point, the new coordinates would be:

box1:[2,1,0]   box2:[2,-1,0]

how can i do that?

3 帖子 / 0 全新
最新文章
如需更全面地了解编译器优化,请参阅优化注意事项

Hi Luis--

Are you looking to manually keyframe rotation of two objects around a point in space, or are you trying to treat these two boxes as if they were connected by an invisible rod so that they rotate  as if a single object?

If the former, you'll need to set the motion type to hkpMotion::MOTION_KEYFRAMED, and call hkpKeyFrameUtility::applyHardKeyFrame() every frame for each body. You'll need to pass this function an appropriate position and rotation each frame, which you can construct with some matrix operations. Please let me know if you need help figuring out exactly what operations you need to perform here.

If the latter, create a single rigid body consisting of an hkpListShape made of the two individual boxes, then set the center of mass to the point around which you want the object to naturally rotate with setCenterOfMassLocal(). 

Please let me know whether this answers your question - thanks!

--Tim

Hi Tim,

I finally made it work.

I used your second approach (hkpListShape) with phantoms to test for collisions and worked like a charm.

thanks for the help!  really appreciated!  :)  you guys are doing a good work in this forum.

发表评论

登录添加评论。还不是成员?立即加入