Notifications
Clear all

[Closed] nodeLocalBoundingBox

This thread helped me get the proper bounds size when the pivot point is rotated oddly, which is good

But now… I’m not sure how I can get the local bounds rotation?
I can create my own matrix, but this time its a bit more complex than in the past.

I know I can create a Y Vector from 2 points, but I can’t use the Max/Min from the Bounds, since it wouldn’t be in a straight line. I’d have to get an offset position from the lower bounds to the top of the bounds box for the proper line.

But even with that, I’d have to use something for a Normal Direction (Z), but I’m not sure what. I can’t use the objects normal Transform, because it could be any direction… :shrug:

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

probably you or me are missing something. local object rotation if its <obj>.objectoffsetrot

Ok, I will try to explain better

Normally calculating Bounds Box isn’t that bad, but lets say you rotate the object a certain way, which again, isn’t bad.

But, what if you rotate an object, but then also use Affect Pivot Only, and rotate the pivot in the opposite direction of the bounds box direction.

This is what I’m trying to figure out. However max is calculating the bounds box of the mesh, according the geo, and not according to the actual transform matrix, this is what I want.

I cannot rely on the standard bounds box it seems, or the nodes transform by default…

how does it calculate the bounding of a camera?

I’m not sure I get what you mean?

Are you hinting at using the viewport transform to get the bounds transform somehow?

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

i want to say that max doesn’t loop through all mesh verts to get its bbox.
max itself doesn’t calculate node’s bbox, it asks the node about its size. using SDK i can write a node that can return any bbox size…

That makes sense. Although , u find the size, but in doing that
Could u get the direction then? I suppose building a matrix from
the points somehow?

This isn’t a make or break thing. My current method works fine
Until the pivot rotation is changed, but I would like to account for
It if possible.

So this code gets me almost there. The only issue is the rotation is facing the Local Rotation direction now, which makes sense for how I’m doing this. Since I’m using the transform.

c = snapshot $
 bounds = in coordsys local nodeLocalBoundingBox c
 bb = bounds[2] - bounds[1]--c.max - c.min
 
 b = box()
 
 b.width = bb[1]
 b.length = bb[2] 
 b.height = bb[3]
 CenterPivot b
 
 delete c
 	
 b.transform = $.transform
 b.pos = $.center
 b.pivot = $.pivot

Edit: By the local rotation, I mean if you rotate the Pivot Only in a direction not aligned to the bounds box.

Here’s what I mean. The box is the right size, but now I just need to align it the same somehow…

Download the video and watch it. VIDEO
This is my Visual Pivot Placer script. There is a button “localBBox” which align orange cage to local bbox. But when the pivot is rotated my code don’t work properly. The only one solution that I know is to reset pivot and then press “localbbox”. So, my advice is:

  • store the pivot transformation
  • reset pivot
  • align your box
  • restore pivot transformation

It’s funny you responded, I just downloaded your script, as you may know and tried it out

I was hoping/wondering if you had it solved, hehe

Is this not work:

  • store the pivot transformation
  • reset pivot
  • align your box
  • restore pivot transformation
Page 2 / 3