vPython/GlowScript传感器位置

2024-06-11 15:32:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我显示了我声明的相机位置(scene.camera.pos)和实际相机位置之间的一些奇怪差异。我真不敢相信这个功能刚刚被破坏了,我是不是遗漏了什么

下面是代码和输出,如下所示

 GlowScript 3.1 VPython

cube = box(pos=vector(0, 0, 0), size=vector(1,1,1), color=color.red, texture=textures.rough)

scene.lights = [distant_light(direction=vector(0.4226, 0, -0.9063),color=color.gray(0.7)),distant_light(direction=vector(0.4226, 0, -0.9063),color=color.gray(0.7))]
scene.background = color.gray(0.8)
scene.camera.pos = vector(3,3,-3)
scene.camera.axis = cube.pos - scene.camera.pos
#scene.forward=cube.pos
#scene.camera.center=cube.pos
#scene.camera.fov = (pi/180)*10
#scene.camera.axis = vector(0, 0, 0)
#scene.up = vector(0,1,0)

while True:
    rate(0.5)
    scene.append_to_title(scene.camera.pos)
    #scene.camera.rotate(angle=0.05, axis=vec(0,0,1), origin=vec(0,10,0))
    #scene.capture("woah")

enter image description here


Tags: pos功能声明差异scenecameracolorlight
2条回答

我想我看到了问题所在。操作摄影机与默认场景之间存在冲突。autoscale=True。如果在操作相机之前设置scene.autoscale=False,我想您会发现程序的行为与预期一致。至少,这意味着需要摄像机文档来指出这种冲突

终于检查回来了,它现在工作正常了

相关问题 更多 >