Tag areas in 3D model with perfectly aligned planes(rectangles)

I am facing an issue which has to do with drawing rectangles (planes) on certain objects in my 3D model. I would like to be able to draw rectangle perfectly aligned with objects.
Please see the following
This is our 3D model in glb format.

I am trying to draw rectangles over certain objects that are not necessarily aligned with the axes of 3D space.

The rectangle is never aligned with objects hence I have to rotate and resize every time which is a difficult thing to do.

I would like to be able to rotate the model and place it in a certain way and draw the rectangles perfectly aligned with the object without having to resize and rotate.

But is there any certain property that defines around which objects the rectangle should appear?
It seems to be placed over arbitrary buildings / cars / half of a parking lot (and not aligned perfectly to any of those.)

1 Like

If you want something like this,

Then you draw a plane with many segments and raycast from the current cameras position to update the positions for each vertices.
But note that it no longer looks like a rectangle when you move the camera.

I found a better approach is to be able to draw any shape, but add vertices one at a time with each mouse click.


1 Like

@mjurczyk Actually I need to draw the rectangle on the model using mouse drag in real time. For example if I am watching the above building, I should be able to draw rectangle on the roof of the building as shown. But the building roof is not aligned with the Axes. So it creates a problem for me to calculate length and width of rectangle, Or if I want to scale then since its not aligned with the axes I am not able to calculate the number by which I need to scale.

@seanwasere That’s a good idea to make a rectangle using its vertices but at the end lets say if we use four vertices (four mouse clicks) to draw that rectangle, It may or may not be a perfect rectangle (Opposite sides should be parallel.)

Is it possible to use mouse drag or may be just two clicks and somehow make it parallel to my camera position.