- 22, Oct 2024
- #1
Я создаю камеру в сцене, используя случайные координаты для
camera_dir = (0, 0, 0) - current_cam_pos
while True:
vel_vec=[uniform(-max_vel, max_vel), uniform(-max_vel, max_vel)] # generate a random velocity vector
new_pos = camera_dir + vel_vec # compute a new position (and camera direction vector) for the camera
if (compute_angle(new_pos, camera_dir) < 45 or compute_angle(new_pos, camera_dir) > 315):
break
and 0
и настройка z
and orient the camera so that it looks on the point (0, 0, 0). My goal is to move the camera forward using randomly-generated velocity vectors on the ground (so z=0
остается y
). I want to ensure that the new position of the camera is within a valid range after moving it forward, defined in degrees with respect to the current focus point/direction. More specifically, the way I determine "valid range" is by ensuring that the new position is within 45 degrees of the old camera's focus point (-45 degrees to the left and +45 degrees to the right). Can someone write a pseudocode on how I can achieve this?
Вот моя попытка сделать это, но, похоже, это неправильный способ помочь мне достичь того, чего я хочу:
x
#3d #2d #камера #физика