fix(cframe): lookat function returning wrong results

This commit is contained in:
maelstrom 2025-03-30 22:40:09 +02:00
parent faf74cba0e
commit dc9ae9d986
3 changed files with 4 additions and 3 deletions

View file

@ -42,9 +42,9 @@ glm::mat3 lookAt(Data::Vector3 position, Data::Vector3 lookAt, Data::Vector3 up)
Data::Vector3 f = (lookAt - position).Unit(); // Forward/Look
Data::Vector3 u = up.Unit(); // Up
Data::Vector3 s = f.Cross(u).Unit(); // Right
u = s.Cross(f);
u = s.Cross(f).Unit();
return { s, u, f };
return { s, u, -f };
}
Data::CFrame::CFrame(Data::Vector3 position, Data::Vector3 lookAt, Data::Vector3 up)

View file

@ -46,7 +46,7 @@ Data::CFrame Handles::GetCFrameOfHandle(HandleFace face) {
Data::Vector3 handleOffset = this->worldMode ? ((Data::Vector3::ONE * 2.f) + adornee->lock()->GetAABB() * 0.5f) : Data::Vector3(2.f + adornee->lock()->size * 0.5f);
Data::Vector3 handlePos = localFrame * (handleOffset * face.normal);
Data::CFrame cframe(handlePos, handlePos + localFrame.Rotation() * face.normal, upAxis);
Data::CFrame cframe(handlePos, handlePos + localFrame.Rotation() * -face.normal, upAxis);
return cframe;
}

View file

@ -193,6 +193,7 @@ void renderHandles() {
glDepthMask(GL_TRUE);
glCullFace(GL_BACK);
glFrontFace(GL_CCW); // This is right... Probably.....
// Use shader
handleShader->use();