3

Currently in debug visualizer, I know I can drag the mouse to swivel the rotation of the camera. Additionally, I can use the mouse wheel to zoom in and out.

But what about translating the camera? Say, along the XYZ world frame axises. Or even along the XYZ camera frame axises. This would make focusing on my object much much easier in the visual debugger. Is this possible?

user3180
  • 1,369
  • 1
  • 21
  • 38

2 Answers2

1

One solution I implemented uses keystroke events as shown here to reset the target position at least along the X and Y axis

keys = p.getKeyboardEvents()
cam = p.getDebugVisualizerCamera()
#Keys to change camera
if keys.get(100):  #D
   xyz = cam[11]
   x= float(xyz[0]) + 0.125
   y = xyz[1]
   z = xyz[2]
   p.resetDebugVisualizerCamera(cameraYaw = cam[8], cameraPitch= cam[9],cameraDistance = cam[10],cameraTargetPosition=[x,y,z])
if keys.get(97):   #A
   xyz = cam[11]
   x= float(xyz[0]) - 0.125
   y = xyz[1]
   z = xyz[2]
   p.resetDebugVisualizerCamera(cameraYaw = cam[8], cameraPitch= cam[9],cameraDistance = cam[10],cameraTargetPosition=[x,y,z])
if keys.get(99):   #C
   xyz = cam[11]
   x = xyz[0] 
   y = float(xyz[1]) + 0.125
   z = xyz[2]
   p.resetDebugVisualizerCamera(cameraYaw = cam[8], cameraPitch= cam[9],cameraDistance = cam[10],cameraTargetPosition=[x,y,z])
if keys.get(102):  #F
   xyz = cam[11]
   x = xyz[0] 
   y = float(xyz[1]) - 0.125
   z = xyz[2]
   p.resetDebugVisualizerCamera(cameraYaw = cam[8], cameraPitch= cam[9],cameraDistance = cam[10],cameraTargetPosition=[x,y,z]) 
Inwernos
  • 11
  • 2
0

A bit late but you can hold Ctrl (or Alt) and move the camera by clicking and dragging the Mouse wheel.

TheMultiplexer
  • 175
  • 2
  • 2
  • 14
  • **I think** OP refers to move the camera in regards of some X, Y and Z coordinates (so moving it with numbers). Having a determined position (X, Y, Z), move the camera like (X-37.8, Y+23.45, Z+102.3) – M.K Oct 24 '22 at 05:56