【问题标题】:vPython / GlowScript Sensor PositionvPython / GlowScript 传感器位置
【发布时间】:2021-09-23 17:44:24
【问题描述】:

我声明的相机位置 (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")

【问题讨论】:

  • 确实好像有问题,而且很混乱。感谢您的报告。

标签: python vpython glowscript


【解决方案1】:

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

【讨论】:

  • 或者,设置scene.range,这也会关闭自动缩放。
【解决方案2】:

终于重新检查了它,它现在可以正常工作了。

【讨论】:

  • 是的,我几天前刚刚解决了这个问题。再次感谢您指出问题。问题是设置 scene.camera.pos/axis 与自动缩放有冲突,但现在设置它们会设置 scene.autoscale = False。
猜你喜欢
  • 2019-12-25
  • 1970-01-01
  • 1970-01-01
  • 2021-08-28
  • 2016-12-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多