I'm currently trying to make a class for the sole purpose of quickly creating a VPython object and appending additional values to the object. VPython automatically creates an object with such values like position and dimensions. However, I also want to add variables such as physical properties of the material and momentum. So here's my solution:
class Bsphere(physicsobject):
def build(self):
sphere(pos=ObjPosition, radius=Rad,color=color.red)
With physicsobject looking something like this:
class physicsobject:
def __init__(self):
self.momentum=Momentum
Essentially, I want this to still retain the original properties of the VPython sphere() object while adding new variables. This actually works initially, the object renders and the variables are added. But now, I have no way of changing the VPython object. If I type in:
Sphereobj.pos=(1,2,3)
The position will update as a variable, however, VPython will not update the rendered object. There is now a disconnect between the object and the rendered object. Is there any way to inherit the rendering aspects of a VPython object while creating a new object? I can't simply use
class Bsphere(sphere(pos=ObjPosition, radius=Rad,color=color.red)):
self.momentum=Momentum
and there isn't much documentation on VPython.