diff --git a/pyrep/backend/sim.py b/pyrep/backend/sim.py index 8484fcd..35b842c 100755 --- a/pyrep/backend/sim.py +++ b/pyrep/backend/sim.py @@ -745,6 +745,15 @@ def simSetShapeColor(shapeHandle, colorName, colorComponent, rgbData): _check_return(res) +def simScaleObject(shapeHandle, scale_x, scale_y, scale_z): + ret = lib.simScaleObject(shapeHandle, scale_x, scale_y, scale_z, 0) + _check_return(ret) + + +def simGetObjectSizeFactor(shapeHandle): + return lib.simGetObjectSizeFactor(shapeHandle) + + def simReorientShapeBoundingBox(shapeHandle, relativeToHandle): ret = lib.simReorientShapeBoundingBox(shapeHandle, relativeToHandle, 0) _check_return(ret) diff --git a/pyrep/objects/object.py b/pyrep/objects/object.py index 39e5f9c..e719ea9 100644 --- a/pyrep/objects/object.py +++ b/pyrep/objects/object.py @@ -120,6 +120,27 @@ def set_name(self, name: str) -> None: """ sim.simSetObjectName(self._handle, name) + def scale_object(self, scale_x: float, scale_y: float, scale_z: float) -> None: + """Scales the object by the given amounts in the x, y, z axes + + Note that this function apply the given scale to the object, it doesn't + set the scale factors. This means that if you apply two calls to this + function with factors of 2.0, this results in the object being scaled + by a factor of 4 in total (it doesn't set an internal scale factor!) + + :param scale_x: The scaling factor along the object's x axis + :param scale_y: The scaling factor along the object's y axis + :param scale_z: The scaling factor along the object's z axis + """ + sim.simScaleObject(self._handle, scale_x, scale_y, scale_z) + + def get_size_factor(self) -> float: + """Gets the object size factor (for scaling purposes) + + :return: The object's size factor + """ + return sim.simGetObjectSizeFactor(self._handle) + def get_position(self, relative_to=None) -> np.ndarray: """Gets the position of this object.