Jump to content
  • Advertisement
Sign in to follow this  
kitman20022002

OpenGL How can I get the roatation in PhysX in opengl

This topic is 909 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone tell me how to get the rotation from PxRigidDynamic class in PhysX I'm using PhysX-3.2.4. I tried to look the docs in nvidia and also tried to used m_helicopter->getGlobalPose().q.getAngle() and m_helicopter->getGlobalPose().q.x which the m_helicopter is a PxRigidDynamic but they both returning not radius or degree , thanks  

Share this post


Link to post
Share on other sites
Advertisement

getGlobalPose returns a PxTransform, and it's q member is a PxQuat(ernion).

 

You can directly convert a PxTransform to a 4x4 matrix with:

PxMat44 tempMat = PxMat44(xform);
 
Or you can convert the quaternion to an axis-and-angle rotation with:
float angle;
PxVec3 axis;
q.toRadiansAndUnitAxis(angle, axis);

Share this post


Link to post
Share on other sites

Just curious how can I get the rotation from the first method ? becasue on the internet seems mixed up a lot of stuff which is not openGL , it will be great it you can point me to the right direction , thanks     

Share this post


Link to post
Share on other sites

What are you trying to do, exactly.

The first method gives you a 4x4 transformation matrix, which contains the rotation and translation. You can use this directly as your object's "world" matrix in GL/D3D.

Share this post


Link to post
Share on other sites
Im making the heading indicator which need the rotation from the helicopter ,and also the second method you told me it seems the maximum is only 6.18 not 6.28 for some reason that i dont understand

Share this post


Link to post
Share on other sites

[X.x  Y.x    Z.x    Tx]

[X.y Y.y    Z.y     Ty]

[X.z  Y.z    Z.z     Tz]

[0     0       0       1]

 

You can get the helicopters right, up and forward vectors from the matrix itself. Those are 3 vectors in world coordinates. Whatever you are doing with heading would deal with the Zx, Zy, Zz vector.
 

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!