jupyter-widgets / pythreejs

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

Geometry can't rotate???? #380

Closed camelator closed 1 year ago

camelator commented 2 years ago

having this simple example: b=BoxGeometry( width=5, height=10, depth=15, widthSegments=5, heightSegments=10, depthSegments=15)

b.rotateX(1)

returns an error: AttributeError: 'BoxGeometry' object has no attribute 'rotateX'

but having a look on the documentation of threejs: https://threejs.org/docs/#api/en/core/BufferGeometry.rotateX

the method exists. How to use it???

vidartf commented 2 years ago

These convenience methods are not directly exposed. Normally you would rotate a mesh with the geometry. If you are certain you need it though, it should be possible to run it with:

b.exec_three_obj_method(self, "rotateX", 1)

The docustring says:

Execute a method on the three object. Excute the method specified by method_name on the three object, with arguments args. kwargs is currently ignored.

camelator commented 2 years ago

Hello Vidartf, many thanks for your answer. It really helps! regards,

Christian