« Return to Thread: displayobject boundary box?

Re: displayobject boundary box?

by quinrou . :: Rate this Message:

Reply to Author | View in Thread

I have a collada model which was loaded with DAE class. That model is made of 3 objects. I need to know the length of one of those objects. Every objects extand the DisplayObject3D hence the boundingBox method isn't available. Looks like this isn't possible. gonna have to hardcode the value..

On Wed, Jul 9, 2008 at 12:56 PM, Andy Zupko <azupko@...> wrote:
most do3d extend vertices3d - so the function is available.  If it doesn't extend vertices3d (its not a mesh) - then what are you trying to measure?

On Jul 9, 2008, at 7:45 AM, quinrou . wrote:

Actually that method is built in Vertices3D... Is there anyway to access it from DisplayObject3D?

On Sat, Jul 5, 2008 at 6:57 PM, J-roen <me@...> wrote:
Hello Seb,

There is actually a method built into papervision that does exactly that:
It is in DisplayObject3D.
So you can do something like:

bbox = this.boundingBox();

and then get properties like:
bbox.min.x / y / z
bbox.size.x / y / z

documentation is here:
http://www.flashbookmarks.com/PV3D-GreatWhite-DOC/org/papervision3d/core/geom/Vertices3D.html#boundingBox()

J-roen

quinrou . schreef:
> Niceone Michael, thanks a lot for that.
> seb
>
> On Wed, Jul 2, 2008 at 7:32 PM, T. Michael Pardon
> <codejockey1@... <mailto:codejockey1@...>> wrote:
>
>     I found this utility class a while back when I was trying to do
>     the same thing.  I don't remember who posted it originally, but if
>     I find the original post I will update this thread.
>
>     package
>     {
>             import org.papervision3d.core.geom.renderables.Vertex3D;
>             import org.papervision3d.objects.DisplayObject3D;
>
>             public class BoundingBox
>             {
>                     public var maxX :Number = 0;
>                     public var minX :Number = 0;
>                     public var maxY :Number = 0;
>                     public var minY :Number = 0;
>                     public var maxZ :Number = 0;
>                     public var minZ :Number = 0;
>
>                     public var sizeX :Number = 0;
>                     public var sizeY :Number = 0;
>                     public var sizeZ :Number = 0;
>
>                     public function BoundingBox( object:DisplayObject3D )
>                     {
>                             parseMesh( object );
>
>                             sizeX = maxX - minX;
>                             sizeY = maxY - minY;
>                             sizeZ = maxZ - minZ;
>                     }
>
>                     private function
>     parseMesh(object:DisplayObject3D):void
>                     {
>                             if (object.children)
>                                     for each(var child:DisplayObject3D
>     in object.children)
>                                             parseMesh(child);
>
>                             if ( !object.geometry)
>                                     return;
>
>                             for each(var vertex:Vertex3D in
>     object.geometry.vertices)
>                             {
>                                     maxX = Math.max(maxX, vertex.x);
>                                     minX = Math.min(minX, vertex.x);
>                                     maxY = Math.max(maxY, vertex.y);
>                                     minY = Math.min(minY, vertex.y);
>                                     maxZ = Math.max(maxZ, vertex.z);
>                                     minZ = Math.min(minZ, vertex.z);
>                             }
>                     }
>             }
>     }
>
>     _______________________________________________
>     Papervision3D mailing list
>     Papervision3D@... <mailto:Papervision3D@...>

_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org


_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org



_______________________________________________
Papervision3D mailing list
Papervision3D@...
http://osflash.org/mailman/listinfo/papervision3d_osflash.org

 « Return to Thread: displayobject boundary box?