Camera Position

Is it possible to get Camera LookAt vector by using its Hpr and Pos, what I am trying to do is that if I have Pos and Hpr of a NodePath can I know its new Hpr if I translate the Pos by a certain amount

It’s not exactly clear to me what you want to do, but you can get the forward vector of the camera using this:

If you want to get a HPR set that would be generated by lookAt for any vector you can use the global variant of lookAt:

from panda3d.core import lookAt

vector = point_to_look_at - pos_of_looking_thing
q = Quat()
lookAt(q, vector)
hpr = q.getHpr()

Suppose the camera is at a position (x1, y1, z1) and Hpr (theta1, theta2, theta3), now what I want to find is the new Hpr , if I go to position (x2, y2, z2) and keep looking at the same point as I was looking at when I was at position (x1, y1, z1) with Hpr(theta1, theta2, theta3), is there any easy way of doing it?

Well, the Hpr angle indicates which direction you are looking at, but not which point you are looking at. In order to be able to calculate this, you need to know either the exact point in 3D space you were looking at (and then plug that into the above calculation), or the distance you are looking at in the given direction.

Is there any way of making a camera move as if you were looking from a moving Vehicle?

Normally when the camera moves via setPos, it keeps looking in the same direction already, so I’m not sure what you mean.

If you want the camera to move and rotate along with a vehicle, the best thing to do is to reparent the camera to the vehicle, so that the position and orientation will be relative to that of the vehicle.

Thanks a lot mate, it really helped me