If I do this (letting autoscale work):
from vpython import *
import json
class MyEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, vector):
return [o.x, o.y, o.z]
scene.width=200
scene.height=200
boxy = box(size=vector(1, 1, 1), color=vector(1, 0.0, 0.0), emissive=True)
boxy_light = local_light(pos=boxy.pos, color=boxy.color)
while True:
rate(30)
c = {
"p": scene.camera.pos,
"fov": scene.fov,
"range": scene.range,
}
scene.caption = json.dumps(c, cls=MyEncoder)
I get this:
If I try to manually set the camera up with the same parameters to get the same result:
from vpython import *
import json
class MyEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, vector):
return [o.x, o.y, o.z]
scene.width=200
scene.height=200
scene.autoscale = False
scene.fov = 1.04
scene.camera.pos = vector(0, 0, 1.732)
scene.forward = -1 * scene.camera.pos
boxy = box(size=vector(1, 1, 1), color=vector(1, 0.0, 0.0), emissive=True)
boxy_light = local_light(pos=boxy.pos, color=boxy.color)
while True:
rate(30)
c = {
"p": scene.camera.pos,
"fov": scene.fov,
"range": scene.range,
}
scene.caption = json.dumps(c, cls=MyEncoder)
I don't get the same results:
What am I doing incorrectly?