jupyter-widgets / pythreejs

A Jupyter - Three.js bridge
https://pythreejs.readthedocs.io
Other
951 stars 188 forks source link

Child object disappears when changing properties of parent #18

Closed ivmi closed 9 years ago

ivmi commented 9 years ago

In the first example, create a second ball and make it a child of first one. In the next cell, change the radius of the first ball. Radius changes, but the second ball disappears.

jasongrout commented 9 years ago

Thanks for reporting this! Can you check to see if it is fixed?

ivmi commented 9 years ago

It's working properly now. Also, now you can put Object3d like this: sphere_container = Object3d(children=[sphere], position=[0,4,0]) and it renders fine (it had the same problem before).

There is another issue. Following code shows black screen, and renders correctly only after i move the camera around, or change some property value:

# create cart and pole
pole_box = Mesh(geometry=BoxGeometry(width=0.3, height=5, depth=0.3), material=LambertMaterial(color='blue'), position=[0,2.5,0])
pole = Mesh(geometry=BoxGeometry(width=0, height=0, depth=0), material=LambertMaterial(color='white'), position=[0,0,0], children=[pole_box])
cart = Mesh(geometry=BoxGeometry(width=4, height=1, depth=3), material=LambertMaterial(color='red'), position=[0,0,0], 
            children=[pole_box])
scene = Scene(children=[cart, AmbientLight(color=0x777777)])
c = PerspectiveCamera(position=[0,0,15], up=[0,1,0], children=[DirectionalLight(color='white', 
                                                                             position=[3,5,1], 
                                                                             intensity=0.5)])
renderer = Renderer(camera=c, scene = scene, controls=[OrbitControls(controlling=c)])
display(renderer)

I would like to help solve it, but my Javascript skills are not up to task. Thanks for the great library!

jasongrout commented 9 years ago

I created a new issue for your comment: #20