These forums are CLOSED. Please visit the new forums HERE
bounding box coords |
|
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-25-2007 17:55
Hi everyone - would someone please let know how to derive the region coordinate vectors of the 8 corners of the box represented by the results returned from llGetBoundingBox. I think I have my head around the concept that a box can be defined by just 2 vectors but anything beyond that is beyond my humble LSL skills.
_____________________
Love Liberty
|
|
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
|
04-25-2007 20:19
Some stuff about this at http://rpgstats.com/wiki/index.php?title=LlGetBoundingBox
|
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-25-2007 20:30
Thanks Ed. I looked at that but all it does is scale the object containing the script to the same size - not much help.
_____________________
Love Liberty
|
|
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
|
04-25-2007 23:36
I'll stick my neck out and tell you how I think it works. Anyone else can jump in and correct me!
Think of a cardboard box's diagonally opposite corners (think longest diagonal between two faces). They go from the corner of the box with lowest x,y,z values up to the corner with the highest x,y and z vealues. The list contains the x,y,z position vectors at the ends of that diagonal. The example quoted shows how to get two vectors min and max and put values to them. So if we look at the box so that min is at the bottom left, closest to us, we are facing north. x increases from left to right, y increases as we look further into the opposite side of the box, and z increases upwards. Vector max will be on the top right corner of the opposing face without changing our pov. So the four corners of the closest face will be: bottom left: min.x, min.y, min.z top left: min.x, min.y, max.z top right: max.x, min.y, max.z bottom right: max.x, min.y, min.z Notice they all used min.y and looking through the box to the far face, we should have bottom left: min.x, max.y, min.z top left: min.x, max.y, max.z top right: max.x, max.y, max.z bottom right: max.x, max.y, min.z Notice they all used max.y hth Ed |
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-26-2007 00:38
I've figured out that much. Its the rest of it I need help with.
I think we have to apply a rotation about the root(not the geometric centre) and then convert them from local to region coords. How do I do this? _____________________
Love Liberty
|
|
Ed Gobo
ed44's alt
Join date: 20 Jun 2006
Posts: 220
|
04-26-2007 00:59
There is no rotation information in a bounding box that I can see.
Might help if you explain what you trying to do? |
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-26-2007 01:10
Its for a collision-avoidance system.
For an obstacle detected by a sensor, we can get the root pos, rotation and a bounding box for it. I think (I hope) thats enough info to derive the coords of the bounding box. But this rotation/vector stuff is all voodoo to me at the moment, so i suppose this is what they call the learning curve. _____________________
Love Liberty
|
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-26-2007 01:36
I was just thinking...
Maybe there's a quick way - What i want I suppose is the coords relative to me, so maybe there is some voodoo to directly translate the obstacle's corners' local coords into my local coords by doing some math with the 2 positions and rotations(mine and the obstacle's) _____________________
Love Liberty
|
|
Lee Ponzu
What Would Steve Do?
Join date: 28 Jun 2006
Posts: 1,770
|
I think...
04-26-2007 07:24
vector in world coord = vector in my coord * my rotation.
vector in my coord = vector in world coord / *my rotation. |
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-26-2007 09:49
The following function returns the Min and Max corners of a world-aligned bounding box, when passed a list containing the Min and Max corners of an object's locally-aligned bounding box (i.e., return value of llGetBoundingBox ), that object's position, and it's rotation.
CODE list WorldBox( list Box, vector Pos, rotation Rot ) |
|
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
|
04-26-2007 09:54
Close, Lee:
vector in world coord = vector in my coord * my rotation + my position vector in my coord = ( vector in world coord - my position ) / my rotation |
|
Ave Amat
Love Liberty
Join date: 21 Mar 2007
Posts: 10
|
04-26-2007 23:46
Ok - I've done it! Thanks everyone for your input. Heres the guts of the method. I know I could use loops and lists to make it more concise, but I'm happy.
CODE
I've now discovered the interesting behaviour of sensors when you try to combine type flags. Did someone actually get paid to create these (mal)functions? Or is this another 'clever' way to throttle us. _____________________
Love Liberty
|