| 59 | static PxReal gGamepadLateralInc = 0.0f; |
| 60 | |
| 61 | static PxVec3 QuatToEuler(const PxQuat& q) |
| 62 | { |
| 63 | PxVec3 dir = -PxMat33(q)[2]; |
| 64 | PxReal r = PxSqrt(dir.x * dir.x + dir.z * dir.z); |
| 65 | PxVec3 rot(0.0f, PxHalfPi, 0.0f); |
| 66 | if (r != 0.0f) |
| 67 | { |
| 68 | rot.x = -PxAtan(dir.y / r); |
| 69 | rot.y = PxAsin(dir.x / r); |
| 70 | if (dir.z > 0.0f) |
| 71 | rot.y = PxPi - rot.y; |
| 72 | } |
| 73 | |
| 74 | return rot; |
| 75 | } |
| 76 | |
| 77 | /////////////////////////////////////////////////////////////////////////////// |
| 78 |