Fix 3D selection box size for Spatial

This commit is contained in:
Haoyu Qiu 2021-04-11 19:01:37 +08:00
parent 7a9c14e276
commit bfa5adb84f

View file

@ -3560,9 +3560,9 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const
AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, bool p_exclude_toplevel_transform) { AABB SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, bool p_exclude_toplevel_transform) {
AABB bounds; AABB bounds;
const MeshInstance *mesh_instance = Object::cast_to<MeshInstance>(p_parent); const VisualInstance *visual_instance = Object::cast_to<VisualInstance>(p_parent);
if (mesh_instance) { if (visual_instance) {
bounds = mesh_instance->get_aabb(); bounds = visual_instance->get_aabb();
} }
for (int i = 0; i < p_parent->get_child_count(); i++) { for (int i = 0; i < p_parent->get_child_count(); i++) {