I have a 3d object that is being moved and rotated in the world. I am keeping track of the current position, the current direction vector (the direction the object is facing), and the "up" vector (orthogonal to direction, essentially the rotation around the direction vector). Translation is easy; what I need is an algorithm which will correctly rotate the object based on this information. I know this is a common operation that is done all the time, but I'm having trouble coming up with a reliable way to do it.