c++ - OpenGL follow object smoothly -
i have little spaceship want follow , smoothly it. calculcate mouse-coordinates , offset last frame, add yaw (x-coordinate) , pitch (y-coordinate), little geometry et voilá have new front-vector followedobject.
currently follow object this:
void camera::update() { glm::vec3 objposition = followedobject->getposition(); this->position = objposition; this->position.z += 15; this->camfront = followedobject->getfront(); this->viewmatrix = glm::lookat(position, position + camfront, camup); } the z-offset used object before camera. whole stuff rather suboptimal. worked great long moved camera around, need better solution.
i'd center followedobject on screen , when perform curve or direction change want camera follow smoothly (like little transition)
do have ideas how improve this?
Comments
Post a Comment