January 22, 2020, 12:35:36 PM

Author Topic: Trying to Draw a 2D Rect Around a Mesh and its Sons  (Read 92 times)

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 369
Trying to Draw a 2D Rect Around a Mesh and its Sons
« on: January 08, 2020, 05:43:59 AM »
Hi. In my Editor, Im trying to Draw a Rect around a Mesh and Its Sons..
taking into account the scale of each Son Mesh..
Ive managed to calculate it somehow.. but it only works if I dont Roll the Mesh..

In other words.. Im tring to havfe a 2D rect around the boundries of a Mesh with Sub Meshes..

If anyone an Idea how to make it in a simple way, that i may not aware of. ill be glad to hear.
Maybe there is a command im not aware of.. who knows..

Also Im looking for a method to have like in unreal editor.. a surrounding line around the chosen mesh..
Hope you guys understand what I mean.
Cheers ;)

Ill find a nice way eventually some how to get what I want :)
Happy New Year

Online Derron

  • Hero Member
  • *****
  • Posts: 2673
Re: Trying to Draw a 2D Rect Around a Mesh and its Sons
« Reply #1 on: January 08, 2020, 08:36:39 AM »
Once you have the visual boundaries ("on screen") of a mesh it is a matter of finding the widest corners of all "boundary rects of interest".

So the problem is to find the visual boundary rect of a mesh. If you can retrieve the non visual boundary rect (so a "rotated" one) then you can use the 4 corners of that rect to identify most top, most left, most right and most bottom point - which you can utilize to find the visual boundary rectangle.


bye
Ron

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 369
Re: Trying to Draw a 2D Rect Around a Mesh and its Sons
« Reply #2 on: January 08, 2020, 01:14:31 PM »
I HAVE A COUPLE of methods to confront that.. ive already solved this by checking vertex points..
Its a deep process but it works..

Im gonna try other methods and publish it here
Happy New Year

Offline Hardcoal

  • Sr. Member
  • ****
  • Posts: 369
Re: Trying to Draw a 2D Rect Around a Mesh and its Sons
« Reply #3 on: January 08, 2020, 03:11:32 PM »
Ok all solved.. It was challenging but not too hard, yet not too simple either
Happy New Year