How to make world space rotations?

How to make world space rotations?


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 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

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!


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.

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!