nimblephysics icon indicating copy to clipboard operation
nimblephysics copied to clipboard

RGBA update breaks python examples

Open gonultasbu opened this issue 3 years ago • 1 comments

Hello,

It looks like the recent RGBA update to the GUI broke the python examples since the new color format is a 4-array (as opposed to 3-array as it was before).

The error is something like this for the initial_conditions.py:

TypeError: createSphere(): incompatible function arguments. The following argument types are supported:
    1. (self: nimblephysics_libs._nimblephysics.server.GUIStateMachine, key: str, radius: float = 0.5, pos: numpy.ndarray[numpy.float64[3, 1]] = array([0., 0., 0.]), color: numpy.ndarray[numpy.float64[4, 1]] = array([0.5, 0.5, 0.5]), castShadows: bool = True, receiveShadows: bool = False) -> None

updating the color to something like color=[255, 0, 0, 255] solves this issue.

gonultasbu avatar Jan 03 '22 17:01 gonultasbu

As of Nov 2022, to make the "Backprop through Physics Timesteps" example work, you could replace the line that creates the sphere with:

gui.nativeAPI().createSphere("goal", radii=[0.1, 0.1, 0.1], pos=[0, 0, 0], color=[0.5, 0.5, 0.5, 1. ])

kirilllzaitsev avatar Nov 13 '22 15:11 kirilllzaitsev