Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera bug in setViewDirection #2248

Open
Ahbee opened this issue Jun 7, 2021 · 1 comment
Open

Camera bug in setViewDirection #2248

Ahbee opened this issue Jun 7, 2021 · 1 comment

Comments

@Ahbee
Copy link
Contributor

Ahbee commented Jun 7, 2021

running this code after the line cp.setOrientation(cp.getOrientation()); the view Direction of the camera flips to {0,-1,0}. This looks like setViewDirection is not setting the orientation correctly

    cinder::CameraPersp` cp;
    cp.setViewDirection({0,1,0});
    std::cout << cp.getViewDirection() << std::endl;
    cp.setOrientation(cp.getOrientation());
    std::cout << cp.getViewDirection() << std::endl;
@Ahbee Ahbee changed the title Camer bug in setViewDirection Camera bug in setViewDirection Jun 7, 2021
@Ahbee
Copy link
Contributor Author

Ahbee commented Jun 7, 2021

changing it to what lookAt does seems fix it

void Camera::setViewDirection(const glm::dvec3& viewDirection)
{
  mViewDirection   = normalize(viewDirection);
  mOrientation     = glm::toQuat(alignZAxisWithTarget(-mViewDirection, mWorldUp));
  mModelViewCached = false;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant