Tag Info

New answers tagged

0

I was able to do this by applying the correction after the initial transformation, though I would prefer an answer that applies the correction prior to the initial transformation so as to avoid transforming the camera twice. After the: _cameraNode->RotateAround(curPos, rotY, Urho3D::TS_LOCAL); _cameraNode->RotateAround(Urho3D::Vector3::ZERO, rotX, ...


1

Assuming your camera have a independent forward vector that always points from position of camera to the character; Suppose if you want to rotate the camera N radians in the local Y axis (character up) and maintains the same distance to target after the rotation: quat = axisAngle(target.up, radian); camera.forward = rotateByQuat(camera.forward, quat); ...


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 = ...



Top 50 recent answers are included