Tag Info

New answers tagged

2

The quaternion you find using your method is indeed correct. However, it’s also pretty unlikely that DirectX::XMQuaternionSlerp would behave incorrectly with such trivial input. Thus, I suspect that the thing you are doing wrong is: trusting what you see in the debugger while running potentially optimised code assuming the layout of a __mm128 would be ...


2

By design, DirectXMath returns for XMQuaternionSlerp the same result as you'd get from the following (inefficient used only for testing) scalar code: XMVECTOR ScalarQuatSlerp(XMVECTOR q1, XMVECTOR q2, float t) { // Extract the components float q1x = XMVectorGetX(q1); float q1y = XMVectorGetY(q1); float q1z = XMVectorGetZ(q1); float q1w = ...


1

It depends on the coordinate system you're working in. In a right-handed coordinate system (eg. x right, y up, z points toward the viewer), the right-hand rule applies, as mklingen describes in the existing answer. In a left-handed coordinate system (eg. x right, y up, z points away from the viewer), the left-hand rule applies - you point your left thumb ...


1

Quaternions are not axis/rotation vectors. That's just not how they work. They do encode an axis/rotation, but not in the way you describe. Check out the equation from wikipedia: Given an axis [a_x, a_y, a_z] and angle theta, q = [a_x * sin(theta / 2), a_y * sin(theta / 2), a_z * sin(theta / 2), cos(theta / 2)] That said, if you do have an axis/rotation ...


0

unless I'm mistaken you want 1+x/100 of a quaternion quat*slerp(quaternion(), quat, X/100) doing a slerp between the null quaternion and the target lets you get the power of a quaternion. or you can acos the w component and then multiplying with the fact = 1+x/100 factor and then get quaternion(cos(acos_w*fact), sin(acos_w*fact)*normalized(quat.xyz)) if ...


0

Your task is to find the forward vector (the blue one) that is pointing towards the other player. This vector can be approximated by finding the tangent at the player position on the shortest arc between the player and the enemy. The tangent of the arc between the two players can be approximated using an approximated derivative (delta). So should we ...



Top 50 recent answers are included