Skip to content

vpython: scene.camera.follow(function) does NOT work #199

@horstjens

Description

@horstjens

using latest vpython version from github,
scene.follow(None) does work now, but letting the camera follow a function as described in the documentation https://www.glowscript.org/docs/VPythonDocs/canvas.html does NOT work. (I guess it also did not worked before the patch).

(tested on Ubuntu Linux 21.10, python 3.9.7, latest vpython version from github (patch #198 )

The problem can be reproduced using idle:

import vpython as vp
b = vp.box()
vp.scene.camera.follow(b)
vp.scene.camera.follow(None) # works !
def f():
... return 2*b.pos
...
vp.scene.camera.follow(f) # does NOT work
Traceback (most recent call last):
File "", line 1, in
File "/home/horst/code/vpython/github version/vpython-jupyter-master/vpython/vpython.py", line 2940, in follow
self.addmethod('follow', obj.idx)
AttributeError: 'function' object has no attribute 'idx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions