nimblephysics
nimblephysics copied to clipboard
RGBA update breaks python examples
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.
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. ])