Calculate the new minimum object center z-position for object given its 3D bounding box and a list of collided 3D bounding boxes.
(object_bbox, collided_bbox_list, extra_elevation=0.1)
| 149 | |
| 150 | |
| 151 | def adjust_z(object_bbox, collided_bbox_list, extra_elevation=0.1): |
| 152 | """ |
| 153 | Calculate the new minimum object center z-position for object given its 3D bounding box and a list of collided 3D bounding boxes. |
| 154 | """ |
| 155 | # Calculate the maximum z_max of the collided bounding boxes |
| 156 | max_z = max(bbox[5] for bbox in collided_bbox_list) |
| 157 | |
| 158 | # Calculate the object's height (z dimension size) |
| 159 | object_height = object_bbox[5] - object_bbox[2] |
| 160 | |
| 161 | # Calculate the new z position for the center of the object's bounding box |
| 162 | new_z_center = max_z + object_height / 2 + extra_elevation |
| 163 | |
| 164 | return new_z_center |
| 165 | |
| 166 | |
| 167 | #################### MoveIt utils #################### |