This commit is contained in:
iDunnoDev
2022-05-16 14:30:07 +01:00
committed by iDunnoDev
parent 03329d30ce
commit eeec232821
3 changed files with 28 additions and 11 deletions

View File

@ -184,9 +184,11 @@ void Camera::Update(void)
cameraTarget = cameraPosition + XMVector3Normalize(cameraForward);
}
else
{
{
XMVECTOR offset = XMVectorSet(_followOffset.x, _followOffset.y, _followOffset.z, 1.0f);
cameraPosition = _nodeFollowed->GetNodePosition() + offset;
XMMATRIX offsetRotationMatrix = XMMatrixRotationAxis(defaultUp, _cameraYaw); // *XMMatrixRotationAxis(defaultForward, _cameraPitch);
cameraPosition = _nodeFollowed->GetNodePosition() + XMVector3TransformCoord(offset, offsetRotationMatrix);
cameraTarget = XMLoadFloat4(&nodePosition) + XMVector3Normalize(cameraForward);
}
// Set the camera position