Merge pull request #12206 from SaracenOne/drag_and_drop_fix
Fix drag and drop collision with non-centred origin points. [ci skip]
This commit is contained in:
commit
eacdcd7239
|
@ -2765,8 +2765,14 @@ Vector3 SpatialEditorViewport::_get_instance_position(const Point2 &p_pos) const
|
||||||
normal = hit_normal;
|
normal = hit_normal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Vector3 center = preview_bounds->get_size() * 0.5;
|
Vector3 offset = Vector3();
|
||||||
return point + (center * normal);
|
for (int i = 0; i < 3; i++) {
|
||||||
|
if (normal[i] > 0.0)
|
||||||
|
offset[i] = (preview_bounds->get_size()[i] - (preview_bounds->get_size()[i] + preview_bounds->get_position()[i]));
|
||||||
|
else if (normal[i] < 0.0)
|
||||||
|
offset[i] = -(preview_bounds->get_size()[i] + preview_bounds->get_position()[i]);
|
||||||
|
}
|
||||||
|
return point + offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect3 SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds) {
|
Rect3 SpatialEditorViewport::_calculate_spatial_bounds(const Spatial *p_parent, const Rect3 p_bounds) {
|
||||||
|
|
Loading…
Reference in New Issue