Is there a direct way to find a 2D bounding box for an object as
finally drawn to the view?
I want to find the top left and bottom right of the object, so I can
crop my swf to just the edges of the object (move the view object,
resize the swf).
I couldn't find anything in the object3D properties or in view3D.
I was thinking a long way would be to draw the whole view to a
bitmapData object with BitmapRenderSession and trawl that for pixel
data, but I'm hoping there's something easier? A sprite object inside
Projector who's x,y, height and width (in 2D) I can grab??
Is there a way to access the graphics container in the view3D or in
the session object? Something that will give me access to the sprite
created for each object?
On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> Is there a direct way to find a 2D bounding box for an object as
> finally drawn to the view?
> I want to find the top left and bottom right of the object, so I can
> crop my swf to just the edges of the object (move the view object,
> resize the swf).
> I couldn't find anything in the object3D properties or in view3D.
> I was thinking a long way would be to draw the whole view to a
> bitmapData object with BitmapRenderSession and trawl that for pixel
> data, but I'm hoping there's something easier? A sprite object inside
> Projector who's x,y, height and width (in 2D) I can grab??
The data in these containers doesn't live long enough to access. I
don't think you can retrieve the properties of the objects without
inserting code into the Away3D classes (and the height and width
default to swf height and width anyway).
Object3D provides objectWidth, objectHeight, and objectDepth
properties, and from these you can calculate with the projection the
width and height of the drawn graphic. Unfortunately, I do not have
the time (or knowledge, probably) to show you how to do this.
I'm curious as to why you need these values, though. To what end does
resizing the swf serve? :)
On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> Is there a way to access the graphics container in the view3D or in
> the session object? Something that will give me access to the sprite
> created for each object?
> On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > Heya again lads!
> > Is there a direct way to find a 2D bounding box for an object as
> > finally drawn to the view?
> > I want to find the top left and bottom right of the object, so I can
> > crop my swf to just the edges of the object (move the view object,
> > resize the swf).
> > I couldn't find anything in the object3D properties or in view3D.
> > I was thinking a long way would be to draw the whole view to a
> > bitmapData object with BitmapRenderSession and trawl that for pixel
> > data, but I'm hoping there's something easier? A sprite object inside
> > Projector who's x,y, height and width (in 2D) I can grab??
Heya Mango, thanks for the response. Yeah I was thinking there's ways
to do it using Matrix math and all the values in the render scene, but
it's well beyond me to do, and I was hoping that the data would be
somewhere in the 3D pipeline and just need to be fished out.
I'm overlaying a 3D object on Google Street View, and it's moving
pretty well with the maps, but if you completely cover the streetview
with another div with flash on it, you can't click and drag on the
streetview below. So I need to calculate my bottle's position, render
it, then move my view and move/crop my swf so it's only the size of
the drawn 3D object :)
On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> The data in these containers doesn't live long enough to access. I
> don't think you can retrieve the properties of the objects without
> inserting code into the Away3D classes (and the height and width
> default to swf height and width anyway).
> Object3D provides objectWidth, objectHeight, and objectDepth
> properties, and from these you can calculate with the projection the
> width and height of the drawn graphic. Unfortunately, I do not have
> the time (or knowledge, probably) to show you how to do this.
> I'm curious as to why you need these values, though. To what end does
> resizing the swf serve? :)
> On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > Is there a way to access the graphics container in the view3D or in
> > the session object? Something that will give me access to the sprite
> > created for each object?
> > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > Heya again lads!
> > > Is there a direct way to find a 2D bounding box for an object as
> > > finally drawn to the view?
> > > I want to find the top left and bottom right of the object, so I can
> > > crop my swf to just the edges of the object (move the view object,
> > > resize the swf).
> > > I couldn't find anything in the object3D properties or in view3D.
> > > I was thinking a long way would be to draw the whole view to a
> > > bitmapData object with BitmapRenderSession and trawl that for pixel
> > > data, but I'm hoping there's something easier? A sprite object inside
> > > Projector who's x,y, height and width (in 2D) I can grab??
I'm not sure if this is easier or more useful, but you can use the
Google Maps API for Flash, add the object to a sprite, and set the
sprite to the background of the view:
var view:View3D = new View3D(...);
var streetView:Sprite = //google street view API
view.background = streetView;
In this way, transparent space will not interfere with mouse clicks as
long as you're not using something that fills the entire view (fog
filter, etc).
Quote:
"The Google Maps API now provides a Street View service for obtaining
and manipulating the imagery used in Google Maps Street View!"
I have no experience with street view or google maps, so this info may
be completely irrevalant or useless. :P
On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> Heya Mango, thanks for the response. Yeah I was thinking there's ways
> to do it using Matrix math and all the values in the render scene, but
> it's well beyond me to do, and I was hoping that the data would be
> somewhere in the 3D pipeline and just need to be fished out.
> I'm overlaying a 3D object on Google Street View, and it's moving
> pretty well with the maps, but if you completely cover the streetview
> with another div with flash on it, you can't click and drag on the
> streetview below. So I need to calculate my bottle's position, render
> it, then move my view and move/crop my swf so it's only the size of
> the drawn 3D object :)
> On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > Hello!
> > The data in these containers doesn't live long enough to access. I
> > don't think you can retrieve the properties of the objects without
> > inserting code into the Away3D classes (and the height and width
> > default to swf height and width anyway).
> > Object3D provides objectWidth, objectHeight, and objectDepth
> > properties, and from these you can calculate with the projection the
> > width and height of the drawn graphic. Unfortunately, I do not have
> > the time (or knowledge, probably) to show you how to do this.
> > I'm curious as to why you need these values, though. To what end does
> > resizing the swf serve? :)
> > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > Is there a way to access the graphics container in the view3D or in
> > > the session object? Something that will give me access to the sprite
> > > created for each object?
> > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > Heya again lads!
> > > > Is there a direct way to find a 2D bounding box for an object as
> > > > finally drawn to the view?
> > > > I want to find the top left and bottom right of the object, so I can
> > > > crop my swf to just the edges of the object (move the view object,
> > > > resize the swf).
> > > > I couldn't find anything in the object3D properties or in view3D.
> > > > I was thinking a long way would be to draw the whole view to a
> > > > bitmapData object with BitmapRenderSession and trawl that for pixel
> > > > data, but I'm hoping there's something easier? A sprite object inside
> > > > Projector who's x,y, height and width (in 2D) I can grab??
> I'm not sure if this is easier or more useful, but you can use the
> Google Maps API for Flash, add the object to a sprite, and set the
> sprite to the background of the view:
> var view:View3D = new View3D(...);
> var streetView:Sprite = //google street view API
> view.background = streetView;
> In this way, transparent space will not interfere with mouse clicks as
> long as you're not using something that fills the entire view (fog
> filter, etc).
> Quote:
> "The Google Maps API now provides a Street View service for obtaining
> and manipulating the imagery used in Google Maps Street View!"
> I have no experience with street view or google maps, so this info may
> be completely irrevalant or useless. :P
> On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > Heya Mango, thanks for the response. Yeah I was thinking there's ways
> > to do it using Matrix math and all the values in the render scene, but
> > it's well beyond me to do, and I was hoping that the data would be
> > somewhere in the 3D pipeline and just need to be fished out.
> > I'm overlaying a 3D object on Google Street View, and it's moving
> > pretty well with the maps, but if you completely cover the streetview
> > with another div with flash on it, you can't click and drag on the
> > streetview below. So I need to calculate my bottle's position, render
> > it, then move my view and move/crop my swf so it's only the size of
> > the drawn 3D object :)
> > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > Hello!
> > > The data in these containers doesn't live long enough to access. I
> > > don't think you can retrieve the properties of the objects without
> > > inserting code into the Away3D classes (and the height and width
> > > default to swf height and width anyway).
> > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > properties, and from these you can calculate with the projection the
> > > width and height of the drawn graphic. Unfortunately, I do not have
> > > the time (or knowledge, probably) to show you how to do this.
> > > I'm curious as to why you need these values, though. To what end does
> > > resizing the swf serve? :)
> > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > Is there a way to access the graphics container in the view3D or in
> > > > the session object? Something that will give me access to the sprite
> > > > created for each object?
> > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > Heya again lads!
> > > > > Is there a direct way to find a 2D bounding box for an object as
> > > > > finally drawn to the view?
> > > > > I want to find the top left and bottom right of the object, so I can
> > > > > crop my swf to just the edges of the object (move the view object,
> > > > > resize the swf).
> > > > > I couldn't find anything in the object3D properties or in view3D.
> > > > > I was thinking a long way would be to draw the whole view to a
> > > > > bitmapData object with BitmapRenderSession and trawl that for pixel
> > > > > data, but I'm hoping there's something easier? A sprite object inside
> > > > > Projector who's x,y, height and width (in 2D) I can grab??
Heya Mango, we were thinking the same here, but it doesn't look like
the actionscript API for google maps includes streetview yet, for that
you need to be using a browser and javascript as far as I can tell :(
On Nov 7, 3:21 pm, Mango <whiskers8...@yahoo.com> wrote:
> On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > I'm not sure if this is easier or more useful, but you can use the
> > Google Maps API for Flash, add the object to a sprite, and set the
> > sprite to the background of the view:
> > var view:View3D = new View3D(...);
> > var streetView:Sprite = //google street view API
> > view.background = streetView;
> > In this way, transparent space will not interfere with mouse clicks as
> > long as you're not using something that fills the entire view (fog
> > filter, etc).
> > Quote:
> > "The Google Maps API now provides a Street View service for obtaining
> > and manipulating the imagery used in Google Maps Street View!"
> > I have no experience with street view or google maps, so this info may
> > be completely irrevalant or useless. :P
> > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > Heya Mango, thanks for the response. Yeah I was thinking there's ways
> > > to do it using Matrix math and all the values in the render scene, but
> > > it's well beyond me to do, and I was hoping that the data would be
> > > somewhere in the 3D pipeline and just need to be fished out.
> > > I'm overlaying a 3D object on Google Street View, and it's moving
> > > pretty well with the maps, but if you completely cover the streetview
> > > with another div with flash on it, you can't click and drag on the
> > > streetview below. So I need to calculate my bottle's position, render
> > > it, then move my view and move/crop my swf so it's only the size of
> > > the drawn 3D object :)
> > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > Hello!
> > > > The data in these containers doesn't live long enough to access. I
> > > > don't think you can retrieve the properties of the objects without
> > > > inserting code into the Away3D classes (and the height and width
> > > > default to swf height and width anyway).
> > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > properties, and from these you can calculate with the projection the
> > > > width and height of the drawn graphic. Unfortunately, I do not have
> > > > the time (or knowledge, probably) to show you how to do this.
> > > > I'm curious as to why you need these values, though. To what end does
> > > > resizing the swf serve? :)
> > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > Is there a way to access the graphics container in the view3D or in
> > > > > the session object? Something that will give me access to the sprite
> > > > > created for each object?
> > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > Heya again lads!
> > > > > > Is there a direct way to find a 2D bounding box for an object as
> > > > > > finally drawn to the view?
> > > > > > I want to find the top left and bottom right of the object, so I can
> > > > > > crop my swf to just the edges of the object (move the view object,
> > > > > > resize the swf).
> > > > > > I couldn't find anything in the object3D properties or in view3D.
> > > > > > I was thinking a long way would be to draw the whole view to a
> > > > > > bitmapData object with BitmapRenderSession and trawl that for pixel
> > > > > > data, but I'm hoping there's something easier? A sprite object inside
> > > > > > Projector who's x,y, height and width (in 2D) I can grab??
have you tried using the bounding radius property yet? you can access the containing radius of any object through the property boundingRadius. This doesn't give you a screen bounding box, but you could use a perspective calulation on the radius to get a view value and work from there.
another quick hack that may be simpler to execute is just taking the rectangle returned from getBounds() on the view! this will give you a Rectangle instance that you can extract all relevant data relating to the bounds of the object inside.
atb
Rob
On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com>wrote:
> Heya Mango, we were thinking the same here, but it doesn't look like > the actionscript API for google maps includes streetview yet, for that > you need to be using a browser and javascript as far as I can tell :(
> > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > I'm not sure if this is easier or more useful, but you can use the > > > Google Maps API for Flash, add the object to a sprite, and set the > > > sprite to the background of the view:
> > > var view:View3D = new View3D(...); > > > var streetView:Sprite = //google street view API > > > view.background = streetView;
> > > In this way, transparent space will not interfere with mouse clicks as > > > long as you're not using something that fills the entire view (fog > > > filter, etc).
> > > Quote: > > > "The Google Maps API now provides a Street View service for obtaining > > > and manipulating the imagery used in Google Maps Street View!"
> > > I have no experience with street view or google maps, so this info may > > > be completely irrevalant or useless. :P
> > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > Heya Mango, thanks for the response. Yeah I was thinking there's ways > > > > to do it using Matrix math and all the values in the render scene, > but > > > > it's well beyond me to do, and I was hoping that the data would be > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > I'm overlaying a 3D object on Google Street View, and it's moving > > > > pretty well with the maps, but if you completely cover the streetview > > > > with another div with flash on it, you can't click and drag on the > > > > streetview below. So I need to calculate my bottle's position, render > > > > it, then move my view and move/crop my swf so it's only the size of > > > > the drawn 3D object :)
> > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > Hello!
> > > > > The data in these containers doesn't live long enough to access. I > > > > > don't think you can retrieve the properties of the objects without > > > > > inserting code into the Away3D classes (and the height and width > > > > > default to swf height and width anyway).
> > > > > Object3D provides objectWidth, objectHeight, and objectDepth > > > > > properties, and from these you can calculate with the projection > the > > > > > width and height of the drawn graphic. Unfortunately, I do not have > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > I'm curious as to why you need these values, though. To what end > does > > > > > resizing the swf serve? :)
> > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > Is there a way to access the graphics container in the view3D or > in > > > > > > the session object? Something that will give me access to the > sprite > > > > > > created for each object?
> > > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> > wrote:
> > > > > > > Heya again lads!
> > > > > > > Is there a direct way to find a 2D bounding box for an object > as > > > > > > > finally drawn to the view?
> > > > > > > I want to find the top left and bottom right of the object, so > I can > > > > > > > crop my swf to just the edges of the object (move the view > object, > > > > > > > resize the swf).
> > > > > > > I couldn't find anything in the object3D properties or in > view3D.
> > > > > > > I was thinking a long way would be to draw the whole view to a > > > > > > > bitmapData object with BitmapRenderSession and trawl that for > pixel > > > > > > > data, but I'm hoping there's something easier? A sprite object > inside > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
Hey thanks for the tip Rob. I've tried using getBounds on the view,
but it's giving me a bounding rectangle the size of the whole canvas.
Do you know what containers I could look at inside the object to get
something that matches the outline of our object?
On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> have you tried using the bounding radius property yet? you can access the
> containing radius of any object through the property boundingRadius. This
> doesn't give you a screen bounding box, but you could use a perspective
> calulation on the radius to get a view value and work from there.
> another quick hack that may be simpler to execute is just taking the
> rectangle returned from getBounds() on the view! this will give you a
> Rectangle instance that you can extract all relevant data relating to the
> bounds of the object inside.
> atb
> Rob
> On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com>wrote:
> > Heya Mango, we were thinking the same here, but it doesn't look like
> > the actionscript API for google maps includes streetview yet, for that
> > you need to be using a browser and javascript as far as I can tell :(
> > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > I'm not sure if this is easier or more useful, but you can use the
> > > > Google Maps API for Flash, add the object to a sprite, and set the
> > > > sprite to the background of the view:
> > > > var view:View3D = new View3D(...);
> > > > var streetView:Sprite = //google street view API
> > > > view.background = streetView;
> > > > In this way, transparent space will not interfere with mouse clicks as
> > > > long as you're not using something that fills the entire view (fog
> > > > filter, etc).
> > > > Quote:
> > > > "The Google Maps API now provides a Street View service for obtaining
> > > > and manipulating the imagery used in Google Maps Street View!"
> > > > I have no experience with street view or google maps, so this info may
> > > > be completely irrevalant or useless. :P
> > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > Heya Mango, thanks for the response. Yeah I was thinking there's ways
> > > > > to do it using Matrix math and all the values in the render scene,
> > but
> > > > > it's well beyond me to do, and I was hoping that the data would be
> > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > I'm overlaying a 3D object on Google Street View, and it's moving
> > > > > pretty well with the maps, but if you completely cover the streetview
> > > > > with another div with flash on it, you can't click and drag on the
> > > > > streetview below. So I need to calculate my bottle's position, render
> > > > > it, then move my view and move/crop my swf so it's only the size of
> > > > > the drawn 3D object :)
> > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > Hello!
> > > > > > The data in these containers doesn't live long enough to access. I
> > > > > > don't think you can retrieve the properties of the objects without
> > > > > > inserting code into the Away3D classes (and the height and width
> > > > > > default to swf height and width anyway).
> > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > properties, and from these you can calculate with the projection
> > the
> > > > > > width and height of the drawn graphic. Unfortunately, I do not have
> > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > I'm curious as to why you need these values, though. To what end
> > does
> > > > > > resizing the swf serve? :)
> > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > Is there a way to access the graphics container in the view3D or
> > in
> > > > > > > the session object? Something that will give me access to the
> > sprite
> > > > > > > created for each object?
> > > > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com>
> > wrote:
> > > > > > > > Heya again lads!
> > > > > > > > Is there a direct way to find a 2D bounding box for an object
> > as
> > > > > > > > finally drawn to the view?
> > > > > > > > I want to find the top left and bottom right of the object, so
> > I can
> > > > > > > > crop my swf to just the edges of the object (move the view
> > object,
> > > > > > > > resize the swf).
> > > > > > > > I couldn't find anything in the object3D properties or in
> > view3D.
> > > > > > > > I was thinking a long way would be to draw the whole view to a
> > > > > > > > bitmapData object with BitmapRenderSession and trawl that for
> > pixel
> > > > > > > > data, but I'm hoping there's something easier? A sprite object
> > inside
> > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
> > > > > > > > Thanks!
> --
> Rob Bateman
> Flash Development & Consultancy
If your object is the only thing in that view, then the width and height of the view itself should be the number you are looking for (quick hack).
I guess you can try this:
hideeverything but the object, render the view, get the width and height of the view, turn on all objects render again...
If it works i guess its not that bad, it's only rendering that one object twice (should be fast). Hope it works and sorry if my idea or dirty hack doesn't work, but it's more fun for me than thinking of the math!
-Pete
On Mon, Nov 10, 2008 at 7:46 PM, bakedbeing <danny.mcgill...@gmail.com>wrote:
> Hey thanks for the tip Rob. I've tried using getBounds on the view, > but it's giving me a bounding rectangle the size of the whole canvas. > Do you know what containers I could look at inside the object to get > something that matches the outline of our object?
> On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote: > > Hey bakedbeing
> > have you tried using the bounding radius property yet? you can access the > > containing radius of any object through the property boundingRadius. This > > doesn't give you a screen bounding box, but you could use a perspective > > calulation on the radius to get a view value and work from there.
> > another quick hack that may be simpler to execute is just taking the > > rectangle returned from getBounds() on the view! this will give you a > > Rectangle instance that you can extract all relevant data relating to the > > bounds of the object inside.
> > atb
> > Rob
> > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com > >wrote:
> > > Heya Mango, we were thinking the same here, but it doesn't look like > > > the actionscript API for google maps includes streetview yet, for that > > > you need to be using a browser and javascript as far as I can tell :(
> > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > I'm not sure if this is easier or more useful, but you can use the > > > > > Google Maps API for Flash, add the object to a sprite, and set the > > > > > sprite to the background of the view:
> > > > > var view:View3D = new View3D(...); > > > > > var streetView:Sprite = //google street view API > > > > > view.background = streetView;
> > > > > In this way, transparent space will not interfere with mouse clicks > as > > > > > long as you're not using something that fills the entire view (fog > > > > > filter, etc).
> > > > > Quote: > > > > > "The Google Maps API now provides a Street View service for > obtaining > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > I have no experience with street view or google maps, so this info > may > > > > > be completely irrevalant or useless. :P
> > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > Heya Mango, thanks for the response. Yeah I was thinking there's > ways > > > > > > to do it using Matrix math and all the values in the render > scene, > > > but > > > > > > it's well beyond me to do, and I was hoping that the data would > be > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > I'm overlaying a 3D object on Google Street View, and it's moving > > > > > > pretty well with the maps, but if you completely cover the > streetview > > > > > > with another div with flash on it, you can't click and drag on > the > > > > > > streetview below. So I need to calculate my bottle's position, > render > > > > > > it, then move my view and move/crop my swf so it's only the size > of > > > > > > the drawn 3D object :)
> > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > Hello!
> > > > > > > The data in these containers doesn't live long enough to > access. I > > > > > > > don't think you can retrieve the properties of the objects > without > > > > > > > inserting code into the Away3D classes (and the height and > width > > > > > > > default to swf height and width anyway).
> > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth > > > > > > > properties, and from these you can calculate with the > projection > > > the > > > > > > > width and height of the drawn graphic. Unfortunately, I do not > have > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > I'm curious as to why you need these values, though. To what > end > > > does > > > > > > > resizing the swf serve? :)
> > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> > wrote:
> > > > > > > > Is there a way to access the graphics container in the view3D > or > > > in > > > > > > > > the session object? Something that will give me access to the > > > sprite > > > > > > > > created for each object?
> > > > > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> > > > wrote:
> > > > > > > > > Heya again lads!
> > > > > > > > > Is there a direct way to find a 2D bounding box for an > object > > > as > > > > > > > > > finally drawn to the view?
> > > > > > > > > I want to find the top left and bottom right of the object, > so > > > I can > > > > > > > > > crop my swf to just the edges of the object (move the view > > > object, > > > > > > > > > resize the swf).
> > > > > > > > > I couldn't find anything in the object3D properties or in > > > view3D.
> > > > > > > > > I was thinking a long way would be to draw the whole view > to a > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that > for > > > pixel > > > > > > > > > data, but I'm hoping there's something easier? A sprite > object > > > inside > > > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
> > > > > > > > > Thanks!
> > -- > > Rob Bateman > > Flash Development & Consultancy
On Mon, Nov 10, 2008 at 9:35 PM, Peter Kapelyan <flashn...@gmail.com> wrote: > If your object is the only thing in that view, then the width and height of > the view itself should be the number you are looking for (quick hack).
> I guess you can try this:
> hideeverything but the object, > render the view, > get the width and height of the view, > turn on all objects > render again...
> If it works i guess its not that bad, it's only rendering that one object > twice (should be fast). > Hope it works and sorry if my idea or dirty hack doesn't work, but it's > more fun for me than thinking of the math!
> -Pete
> On Mon, Nov 10, 2008 at 7:46 PM, bakedbeing <danny.mcgill...@gmail.com>wrote:
>> Hey thanks for the tip Rob. I've tried using getBounds on the view, >> but it's giving me a bounding rectangle the size of the whole canvas. >> Do you know what containers I could look at inside the object to get >> something that matches the outline of our object?
>> On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote: >> > Hey bakedbeing
>> > have you tried using the bounding radius property yet? you can access >> the >> > containing radius of any object through the property boundingRadius. >> This >> > doesn't give you a screen bounding box, but you could use a perspective >> > calulation on the radius to get a view value and work from there.
>> > another quick hack that may be simpler to execute is just taking the >> > rectangle returned from getBounds() on the view! this will give you a >> > Rectangle instance that you can extract all relevant data relating to >> the >> > bounds of the object inside.
>> > atb
>> > Rob
>> > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com >> >wrote:
>> > > Heya Mango, we were thinking the same here, but it doesn't look like >> > > the actionscript API for google maps includes streetview yet, for that >> > > you need to be using a browser and javascript as far as I can tell :(
>> > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
>> > > > > I'm not sure if this is easier or more useful, but you can use the >> > > > > Google Maps API for Flash, add the object to a sprite, and set the >> > > > > sprite to the background of the view:
>> > > > > var view:View3D = new View3D(...); >> > > > > var streetView:Sprite = //google street view API >> > > > > view.background = streetView;
>> > > > > In this way, transparent space will not interfere with mouse >> clicks as >> > > > > long as you're not using something that fills the entire view (fog >> > > > > filter, etc).
>> > > > > Quote: >> > > > > "The Google Maps API now provides a Street View service for >> obtaining >> > > > > and manipulating the imagery used in Google Maps Street View!"
>> > > > > I have no experience with street view or google maps, so this info >> may >> > > > > be completely irrevalant or useless. :P
>> > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
>> > > > > > Heya Mango, thanks for the response. Yeah I was thinking there's >> ways >> > > > > > to do it using Matrix math and all the values in the render >> scene, >> > > but >> > > > > > it's well beyond me to do, and I was hoping that the data would >> be >> > > > > > somewhere in the 3D pipeline and just need to be fished out.
>> > > > > > I'm overlaying a 3D object on Google Street View, and it's >> moving >> > > > > > pretty well with the maps, but if you completely cover the >> streetview >> > > > > > with another div with flash on it, you can't click and drag on >> the >> > > > > > streetview below. So I need to calculate my bottle's position, >> render >> > > > > > it, then move my view and move/crop my swf so it's only the size >> of >> > > > > > the drawn 3D object :)
>> > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
>> > > > > > > Hello!
>> > > > > > > The data in these containers doesn't live long enough to >> access. I >> > > > > > > don't think you can retrieve the properties of the objects >> without >> > > > > > > inserting code into the Away3D classes (and the height and >> width >> > > > > > > default to swf height and width anyway).
>> > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth >> > > > > > > properties, and from these you can calculate with the >> projection >> > > the >> > > > > > > width and height of the drawn graphic. Unfortunately, I do not >> have >> > > > > > > the time (or knowledge, probably) to show you how to do this.
>> > > > > > > I'm curious as to why you need these values, though. To what >> end >> > > does >> > > > > > > resizing the swf serve? :)
>> > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> >> wrote:
>> > > > > > > > Is there a way to access the graphics container in the >> view3D or >> > > in >> > > > > > > > the session object? Something that will give me access to >> the >> > > sprite >> > > > > > > > created for each object?
>> > > > > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com> >> > > wrote:
>> > > > > > > > > Heya again lads!
>> > > > > > > > > Is there a direct way to find a 2D bounding box for an >> object >> > > as >> > > > > > > > > finally drawn to the view?
>> > > > > > > > > I want to find the top left and bottom right of the >> object, so >> > > I can >> > > > > > > > > crop my swf to just the edges of the object (move the view >> > > object, >> > > > > > > > > resize the swf).
>> > > > > > > > > I couldn't find anything in the object3D properties or in >> > > view3D.
>> > > > > > > > > I was thinking a long way would be to draw the whole view >> to a >> > > > > > > > > bitmapData object with BitmapRenderSession and trawl that >> for >> > > pixel >> > > > > > > > > data, but I'm hoping there's something easier? A sprite >> object >> > > inside >> > > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
>> > > > > > > > > Thanks!
>> > -- >> > Rob Bateman >> > Flash Development & Consultancy
Rob and Peter both have the right idea. Unfortunately, when you add
the view sprite to the parent, it inherits the parent's dimensions.
Solution? Create two identical scenes, but only add one to the parent
display object.
AS3:
public class BoundTest extends Sprite {
private var view:View3D;
private var view2:View3D;
private var cube:Cube;
private var cube2:Cube;
private var rect:Rectangle;
public function BoundTest() {
init();
}
private function init():void {
view = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
-150, 190, 150)});
view2 = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
-150, 190, 150)});
cube = new Cube();
cube2 = new Cube();
view.scene.addChild(cube);
view2.scene.addChild(cube2);
> Hey thanks for the tip Rob. I've tried using getBounds on the view,
> but it's giving me a bounding rectangle the size of the whole canvas.
> Do you know what containers I could look at inside the object to get
> something that matches the outline of our object?
> On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > Hey bakedbeing
> > have you tried using the bounding radius property yet? you can access the
> > containing radius of any object through the property boundingRadius. This
> > doesn't give you a screen bounding box, but you could use a perspective
> > calulation on the radius to get a view value and work from there.
> > another quick hack that may be simpler to execute is just taking the
> > rectangle returned from getBounds() on the view! this will give you a
> > Rectangle instance that you can extract all relevant data relating to the
> > bounds of the object inside.
> > atb
> > Rob
> > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com>wrote:
> > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > the actionscript API for google maps includes streetview yet, for that
> > > you need to be using a browser and javascript as far as I can tell :(
> > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > I'm not sure if this is easier or more useful, but you can use the
> > > > > Google Maps API for Flash, add the object to a sprite, and set the
> > > > > sprite to the background of the view:
> > > > > var view:View3D = new View3D(...);
> > > > > var streetView:Sprite = //google street view API
> > > > > view.background = streetView;
> > > > > In this way, transparent space will not interfere with mouse clicks as
> > > > > long as you're not using something that fills the entire view (fog
> > > > > filter, etc).
> > > > > Quote:
> > > > > "The Google Maps API now provides a Street View service for obtaining
> > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > I have no experience with street view or google maps, so this info may
> > > > > be completely irrevalant or useless. :P
> > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > Heya Mango, thanks for the response. Yeah I was thinking there's ways
> > > > > > to do it using Matrix math and all the values in the render scene,
> > > but
> > > > > > it's well beyond me to do, and I was hoping that the data would be
> > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > I'm overlaying a 3D object on Google Street View, and it's moving
> > > > > > pretty well with the maps, but if you completely cover the streetview
> > > > > > with another div with flash on it, you can't click and drag on the
> > > > > > streetview below. So I need to calculate my bottle's position, render
> > > > > > it, then move my view and move/crop my swf so it's only the size of
> > > > > > the drawn 3D object :)
> > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > Hello!
> > > > > > > The data in these containers doesn't live long enough to access. I
> > > > > > > don't think you can retrieve the properties of the objects without
> > > > > > > inserting code into the Away3D classes (and the height and width
> > > > > > > default to swf height and width anyway).
> > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > properties, and from these you can calculate with the projection
> > > the
> > > > > > > width and height of the drawn graphic. Unfortunately, I do not have
> > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > I'm curious as to why you need these values, though. To what end
> > > does
> > > > > > > resizing the swf serve? :)
> > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > Is there a way to access the graphics container in the view3D or
> > > in
> > > > > > > > the session object? Something that will give me access to the
> > > sprite
> > > > > > > > created for each object?
> > > > > > > > On Nov 7, 10:16 am, bakedbeing <danny.mcgill...@gmail.com>
> > > wrote:
> > > > > > > > > Heya again lads!
> > > > > > > > > Is there a direct way to find a 2D bounding box for an object
> > > as
> > > > > > > > > finally drawn to the view?
> > > > > > > > > I want to find the top left and bottom right of the object, so
> > > I can
> > > > > > > > > crop my swf to just the edges of the object (move the view
> > > object,
> > > > > > > > > resize the swf).
> > > > > > > > > I couldn't find anything in the object3D properties or in
> > > view3D.
> > > > > > > > > I was thinking a long way would be to draw the whole view to a
> > > > > > > > > bitmapData object with BitmapRenderSession and trawl that for
> > > pixel
> > > > > > > > > data, but I'm hoping there's something easier? A sprite object
> > > inside
> > > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
> > > > > > > > > Thanks!
> > --
> > Rob Bateman
> > Flash Development & Consultancy
Notice the RectangleClipping added to both views. For the view that is
not added to the parent display object, it is necessary to specify a
Clipping, because the view Sprite does not have access to stage
properties.
On Nov 11, 12:49 am, Mango <whiskers8...@yahoo.com> wrote:
> Rob and Peter both have the right idea. Unfortunately, when you add
> the view sprite to the parent, it inherits the parent's dimensions.
> Solution? Create two identical scenes, but only add one to the parent
> display object.
> AS3:
> public class BoundTest extends Sprite {
> private var view:View3D;
> private var view2:View3D;
> private var cube:Cube;
> private var cube2:Cube;
> private var rect:Rectangle;
> public function BoundTest() {
> init();
> }
> private function init():void {
> view = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
> -150, 190, 150)});
> view2 = new View3D({x:200, y:200, clip:new RectangleClipping(-190,
> -150, 190, 150)});
> cube = new Cube();
> cube2 = new Cube();
> view.scene.addChild(cube);
> view2.scene.addChild(cube2);
> view2.render();
> rect = view2.getBounds(this);
> view.render();
> trace(rect.width + ", " + rect.height);
> }
> }// of class
> On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > but it's giving me a bounding rectangle the size of the whole canvas.
> > Do you know what containers I could look at inside the object to get
> > something that matches the outline of our object?
> > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > Hey bakedbeing
> > > have you tried using the bounding radius property yet? you can access the
> > > containing radius of any object through the property boundingRadius. This
> > > doesn't give you a screen bounding box, but you could use a perspective
> > > calulation on the radius to get a view value and work from there.
> > > another quick hack that may be simpler to execute is just taking the
> > > rectangle returned from getBounds() on the view! this will give you a
> > > Rectangle instance that you can extract all relevant data relating to the
> > > bounds of the object inside.
> > > atb
> > > Rob
> > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com>wrote:
> > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > the actionscript API for google maps includes streetview yet, for that
> > > > you need to be using a browser and javascript as far as I can tell :(
> > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > I'm not sure if this is easier or more useful, but you can use the
> > > > > > Google Maps API for Flash, add the object to a sprite, and set the
> > > > > > sprite to the background of the view:
> > > > > > var view:View3D = new View3D(...);
> > > > > > var streetView:Sprite = //google street view API
> > > > > > view.background = streetView;
> > > > > > In this way, transparent space will not interfere with mouse clicks as
> > > > > > long as you're not using something that fills the entire view (fog
> > > > > > filter, etc).
> > > > > > Quote:
> > > > > > "The Google Maps API now provides a Street View service for obtaining
> > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > I have no experience with street view or google maps, so this info may
> > > > > > be completely irrevalant or useless. :P
> > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > Heya Mango, thanks for the response. Yeah I was thinking there's ways
> > > > > > > to do it using Matrix math and all the values in the render scene,
> > > > but
> > > > > > > it's well beyond me to do, and I was hoping that the data would be
> > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > I'm overlaying a 3D object on Google Street View, and it's moving
> > > > > > > pretty well with the maps, but if you completely cover the streetview
> > > > > > > with another div with flash on it, you can't click and drag on the
> > > > > > > streetview below. So I need to calculate my bottle's position, render
> > > > > > > it, then move my view and move/crop my swf so it's only the size of
> > > > > > > the drawn 3D object :)
> > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > Hello!
> > > > > > > > The data in these containers doesn't live long enough to access. I
> > > > > > > > don't think you can retrieve the properties of the objects without
> > > > > > > > inserting code into the Away3D classes (and the height and width
> > > > > > > > default to swf height and width anyway).
> > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > properties, and from these you can calculate with the projection
> > > > the
> > > > > > > > width and height of the drawn graphic. Unfortunately, I do not have
> > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > I'm curious as to why you need these values, though. To what end
> > > > does
> > > > > > > > resizing the swf serve? :)
> > > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > > Is there a way to access the graphics container in the view3D or
> > > > in
> > > > > > > > > the session object? Something that will give me access to the
> > > > sprite
> > > > > > > > > created for each object?
> > > > > > > > > > Is there a direct way to find a 2D bounding box for an object
> > > > as
> > > > > > > > > > finally drawn to the view?
> > > > > > > > > > I want to find the top left and bottom right of the object, so
> > > > I can
> > > > > > > > > > crop my swf to just the edges of the object (move the view
> > > > object,
> > > > > > > > > > resize the swf).
> > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > view3D.
> > > > > > > > > > I was thinking a long way would be to draw the whole view to a
> > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that for
> > > > pixel
> > > > > > > > > > data, but I'm hoping there's something easier? A sprite object
> > > > inside
> > > > > > > > > > Projector who's x,y, height and width (in 2D) I can grab??
> > > > > > > > > > Thanks!
> > > --
> > > Rob Bateman
> > > Flash Development & Consultancy
On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> Rob and Peter both have the right idea. Unfortunately, when you add > the view sprite to the parent, it inherits the parent's dimensions. > Solution? Create two identical scenes, but only add one to the parent > display object.
> AS3: > public class BoundTest extends Sprite { > private var view:View3D; > private var view2:View3D; > private var cube:Cube; > private var cube2:Cube; > private var rect:Rectangle;
> public function BoundTest() { > init(); > }
> private function init():void { > view = new View3D({x:200, y:200, clip:new RectangleClipping(-190, > -150, 190, 150)}); > view2 = new View3D({x:200, y:200, clip:new RectangleClipping(-190, > -150, 190, 150)}); > cube = new Cube(); > cube2 = new Cube(); > view.scene.addChild(cube); > view2.scene.addChild(cube2);
> view2.render(); > rect = view2.getBounds(this); > view.render();
> trace(rect.width + ", " + rect.height); > } > }// of class
> On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote: > > Hey thanks for the tip Rob. I've tried using getBounds on the view, > > but it's giving me a bounding rectangle the size of the whole canvas. > > Do you know what containers I could look at inside the object to get > > something that matches the outline of our object?
> > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > Hey bakedbeing
> > > have you tried using the bounding radius property yet? you can access > the > > > containing radius of any object through the property boundingRadius. > This > > > doesn't give you a screen bounding box, but you could use a perspective > > > calulation on the radius to get a view value and work from there.
> > > another quick hack that may be simpler to execute is just taking the > > > rectangle returned from getBounds() on the view! this will give you a > > > Rectangle instance that you can extract all relevant data relating to > the > > > bounds of the object inside.
> > > atb
> > > Rob
> > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com > >wrote:
> > > > Heya Mango, we were thinking the same here, but it doesn't look like > > > > the actionscript API for google maps includes streetview yet, for > that > > > > you need to be using a browser and javascript as far as I can tell > :(
> > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > I'm not sure if this is easier or more useful, but you can use > the > > > > > > Google Maps API for Flash, add the object to a sprite, and set > the > > > > > > sprite to the background of the view:
> > > > > > var view:View3D = new View3D(...); > > > > > > var streetView:Sprite = //google street view API > > > > > > view.background = streetView;
> > > > > > In this way, transparent space will not interfere with mouse > clicks as > > > > > > long as you're not using something that fills the entire view > (fog > > > > > > filter, etc).
> > > > > > Quote: > > > > > > "The Google Maps API now provides a Street View service for > obtaining > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > I have no experience with street view or google maps, so this > info may > > > > > > be completely irrevalant or useless. :P
> > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > Heya Mango, thanks for the response. Yeah I was thinking > there's ways > > > > > > > to do it using Matrix math and all the values in the render > scene, > > > > but > > > > > > > it's well beyond me to do, and I was hoping that the data would > be > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > I'm overlaying a 3D object on Google Street View, and it's > moving > > > > > > > pretty well with the maps, but if you completely cover the > streetview > > > > > > > with another div with flash on it, you can't click and drag on > the > > > > > > > streetview below. So I need to calculate my bottle's position, > render > > > > > > > it, then move my view and move/crop my swf so it's only the > size of > > > > > > > the drawn 3D object :)
> > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > Hello!
> > > > > > > > The data in these containers doesn't live long enough to > access. I > > > > > > > > don't think you can retrieve the properties of the objects > without > > > > > > > > inserting code into the Away3D classes (and the height and > width > > > > > > > > default to swf height and width anyway).
> > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth > > > > > > > > properties, and from these you can calculate with the > projection > > > > the > > > > > > > > width and height of the drawn graphic. Unfortunately, I do > not have > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > I'm curious as to why you need these values, though. To what > end > > > > does > > > > > > > > resizing the swf serve? :)
> > > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com> > wrote:
> > > > > > > > > Is there a way to access the graphics container in the > view3D or > > > > in > > > > > > > > > the session object? Something that will give me access to > the > > > > sprite > > > > > > > > > created for each object?
> > > > > > > > > > Is there a direct way to find a 2D bounding box for an > object > > > > as > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > I want to find the top left and bottom right of the > object, so > > > > I can > > > > > > > > > > crop my swf to just the edges of the object (move the > view > > > > object, > > > > > > > > > > resize the swf).
> > > > > > > > > > I couldn't find anything in the object3D properties or in > > > > view3D.
> > > > > > > > > > I was thinking a long way would be to draw the whole view > to a > > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that > for > > > > pixel > > > > > > > > > > data, but I'm hoping there's something easier? A sprite > object > > > > inside > > > > > > > > > > Projector who's x,y, height and width (in 2D) I can > grab??
> > > > > > > > > > Thanks!
> > > -- > > > Rob Bateman > > > Flash Development & Consultancy
> Thank you for taking your time to help out, and for your example!
> -Pete
> On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> > Rob and Peter both have the right idea. Unfortunately, when you add
> > the view sprite to the parent, it inherits the parent's dimensions.
> > Solution? Create two identical scenes, but only add one to the parent
> > display object.
> > Example:
> >http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda > > (Sorry about the hosting link. My site is not up currently, so I
> > cannot host it properly. Also, the file upload on this site doesn't
> > appear to load swfs. Feel free to rehost.)
> > AS3:
> > public class BoundTest extends Sprite {
> > private var view:View3D;
> > private var view2:View3D;
> > private var cube:Cube;
> > private var cube2:Cube;
> > private var rect:Rectangle;
> > public function BoundTest() {
> > init();
> > }
> > trace(rect.width + ", " + rect.height);
> > }
> > }// of class
> > On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > > but it's giving me a bounding rectangle the size of the whole canvas.
> > > Do you know what containers I could look at inside the object to get
> > > something that matches the outline of our object?
> > > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > > Hey bakedbeing
> > > > have you tried using the bounding radius property yet? you can access
> > the
> > > > containing radius of any object through the property boundingRadius.
> > This
> > > > doesn't give you a screen bounding box, but you could use a perspective
> > > > calulation on the radius to get a view value and work from there.
> > > > another quick hack that may be simpler to execute is just taking the
> > > > rectangle returned from getBounds() on the view! this will give you a
> > > > Rectangle instance that you can extract all relevant data relating to
> > the
> > > > bounds of the object inside.
> > > > atb
> > > > Rob
> > > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com
> > >wrote:
> > > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > > the actionscript API for google maps includes streetview yet, for
> > that
> > > > > you need to be using a browser and javascript as far as I can tell
> > :(
> > > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > I'm not sure if this is easier or more useful, but you can use
> > the
> > > > > > > Google Maps API for Flash, add the object to a sprite, and set
> > the
> > > > > > > sprite to the background of the view:
> > > > > > > var view:View3D = new View3D(...);
> > > > > > > var streetView:Sprite = //google street view API
> > > > > > > view.background = streetView;
> > > > > > > In this way, transparent space will not interfere with mouse
> > clicks as
> > > > > > > long as you're not using something that fills the entire view
> > (fog
> > > > > > > filter, etc).
> > > > > > > Quote:
> > > > > > > "The Google Maps API now provides a Street View service for
> > obtaining
> > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > > I have no experience with street view or google maps, so this
> > info may
> > > > > > > be completely irrevalant or useless. :P
> > > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > Heya Mango, thanks for the response. Yeah I was thinking
> > there's ways
> > > > > > > > to do it using Matrix math and all the values in the render
> > scene,
> > > > > but
> > > > > > > > it's well beyond me to do, and I was hoping that the data would
> > be
> > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > > I'm overlaying a 3D object on Google Street View, and it's
> > moving
> > > > > > > > pretty well with the maps, but if you completely cover the
> > streetview
> > > > > > > > with another div with flash on it, you can't click and drag on
> > the
> > > > > > > > streetview below. So I need to calculate my bottle's position,
> > render
> > > > > > > > it, then move my view and move/crop my swf so it's only the
> > size of
> > > > > > > > the drawn 3D object :)
> > > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > Hello!
> > > > > > > > > The data in these containers doesn't live long enough to
> > access. I
> > > > > > > > > don't think you can retrieve the properties of the objects
> > without
> > > > > > > > > inserting code into the Away3D classes (and the height and
> > width
> > > > > > > > > default to swf height and width anyway).
> > > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > > properties, and from these you can calculate with the
> > projection
> > > > > the
> > > > > > > > > width and height of the drawn graphic. Unfortunately, I do
> > not have
> > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > > I'm curious as to why you need these values, though. To what
> > end
> > > > > does
> > > > > > > > > resizing the swf serve? :)
> > > > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com>
> > wrote:
> > > > > > > > > > Is there a way to access the graphics container in the
> > view3D or
> > > > > in
> > > > > > > > > > the session object? Something that will give me access to
> > the
> > > > > sprite
> > > > > > > > > > created for each object?
> > > > > > > > > > > Is there a direct way to find a 2D bounding box for an
> > object
> > > > > as
> > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > > I want to find the top left and bottom right of the
> > object, so
> > > > > I can
> > > > > > > > > > > crop my swf to just the edges of the object (move the
> > view
> > > > > object,
> > > > > > > > > > > resize the swf).
> > > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > > view3D.
> > > > > > > > > > > I was thinking a long way would be to draw the whole view
> > to a
> > > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that
> > for
> > > > > pixel
> > > > > > > > > > > data, but I'm hoping there's something easier? A sprite
> > object
> > > > > inside
> > > > > > > > > > > Projector who's x,y, height and width (in 2D) I can
> > grab??
> > > > > > > > > > > Thanks!
> > > > --
> > > > Rob Bateman
> > > > Flash Development & Consultancy
> Thank you for taking your time to help out, and for your example!
> -Pete
> On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> > Rob and Peter both have the right idea. Unfortunately, when you add
> > the view sprite to the parent, it inherits the parent's dimensions.
> > Solution? Create two identical scenes, but only add one to the parent
> > display object.
> > Example:
> >http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda > > (Sorry about the hosting link. My site is not up currently, so I
> > cannot host it properly. Also, the file upload on this site doesn't
> > appear to load swfs. Feel free to rehost.)
> > AS3:
> > public class BoundTest extends Sprite {
> > private var view:View3D;
> > private var view2:View3D;
> > private var cube:Cube;
> > private var cube2:Cube;
> > private var rect:Rectangle;
> > public function BoundTest() {
> > init();
> > }
> > trace(rect.width + ", " + rect.height);
> > }
> > }// of class
> > On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > > but it's giving me a bounding rectangle the size of the whole canvas.
> > > Do you know what containers I could look at inside the object to get
> > > something that matches the outline of our object?
> > > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > > Hey bakedbeing
> > > > have you tried using the bounding radius property yet? you can access
> > the
> > > > containing radius of any object through the property boundingRadius.
> > This
> > > > doesn't give you a screen bounding box, but you could use a perspective
> > > > calulation on the radius to get a view value and work from there.
> > > > another quick hack that may be simpler to execute is just taking the
> > > > rectangle returned from getBounds() on the view! this will give you a
> > > > Rectangle instance that you can extract all relevant data relating to
> > the
> > > > bounds of the object inside.
> > > > atb
> > > > Rob
> > > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com
> > >wrote:
> > > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > > the actionscript API for google maps includes streetview yet, for
> > that
> > > > > you need to be using a browser and javascript as far as I can tell
> > :(
> > > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > I'm not sure if this is easier or more useful, but you can use
> > the
> > > > > > > Google Maps API for Flash, add the object to a sprite, and set
> > the
> > > > > > > sprite to the background of the view:
> > > > > > > var view:View3D = new View3D(...);
> > > > > > > var streetView:Sprite = //google street view API
> > > > > > > view.background = streetView;
> > > > > > > In this way, transparent space will not interfere with mouse
> > clicks as
> > > > > > > long as you're not using something that fills the entire view
> > (fog
> > > > > > > filter, etc).
> > > > > > > Quote:
> > > > > > > "The Google Maps API now provides a Street View service for
> > obtaining
> > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > > I have no experience with street view or google maps, so this
> > info may
> > > > > > > be completely irrevalant or useless. :P
> > > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > Heya Mango, thanks for the response. Yeah I was thinking
> > there's ways
> > > > > > > > to do it using Matrix math and all the values in the render
> > scene,
> > > > > but
> > > > > > > > it's well beyond me to do, and I was hoping that the data would
> > be
> > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > > I'm overlaying a 3D object on Google Street View, and it's
> > moving
> > > > > > > > pretty well with the maps, but if you completely cover the
> > streetview
> > > > > > > > with another div with flash on it, you can't click and drag on
> > the
> > > > > > > > streetview below. So I need to calculate my bottle's position,
> > render
> > > > > > > > it, then move my view and move/crop my swf so it's only the
> > size of
> > > > > > > > the drawn 3D object :)
> > > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > Hello!
> > > > > > > > > The data in these containers doesn't live long enough to
> > access. I
> > > > > > > > > don't think you can retrieve the properties of the objects
> > without
> > > > > > > > > inserting code into the Away3D classes (and the height and
> > width
> > > > > > > > > default to swf height and width anyway).
> > > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > > properties, and from these you can calculate with the
> > projection
> > > > > the
> > > > > > > > > width and height of the drawn graphic. Unfortunately, I do
> > not have
> > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > > I'm curious as to why you need these values, though. To what
> > end
> > > > > does
> > > > > > > > > resizing the swf serve? :)
> > > > > > > > > On Nov 6, 5:44 pm, bakedbeing <danny.mcgill...@gmail.com>
> > wrote:
> > > > > > > > > > Is there a way to access the graphics container in the
> > view3D or
> > > > > in
> > > > > > > > > > the session object? Something that will give me access to
> > the
> > > > > sprite
> > > > > > > > > > created for each object?
> > > > > > > > > > > Is there a direct way to find a 2D bounding box for an
> > object
> > > > > as
> > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > > I want to find the top left and bottom right of the
> > object, so
> > > > > I can
> > > > > > > > > > > crop my swf to just the edges of the object (move the
> > view
> > > > > object,
> > > > > > > > > > > resize the swf).
> > > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > > view3D.
> > > > > > > > > > > I was thinking a long way would be to draw the whole view
> > to a
> > > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that
> > for
> > > > > pixel
> > > > > > > > > > > data, but I'm hoping there's something easier? A sprite
> > object
> > > > > inside
> > > > > > > > > > > Projector who's x,y, height and width (in 2D) I can
> > grab??
> > > > > > > > > > > Thanks!
> > > > --
> > > > Rob Bateman
> > > > Flash Development & Consultancy
Heya gents, thanks for working so hard on that solution Mango, I'll
have a good look through it this afternoon. As you mentioned above,
after a morning of digging through the source I managed to figure out
that the contents of the session.container object report their bounds
as being flush with their edges, not the entire view. I'll post the
code here for anyone who should come looking:
Here's a way to use the Session object within your View3D to find the
bounds of an object you've drawn to the screen with view.render().
This example is built for a single object, in my case an imported OBJ
file. The coordinates returned are relative to (this), the movie
within which the view object is contained.
// view has been defined previously, it's our View3D object.
var sessionContainer:DisplayObjectContainer =
view.session.getContainer(view) as DisplayObjectContainer;
var drawnObject = sessionContainer.getChildAt(0);
var viewBounds = drawnObject.getRect(this);
trace("vb: " + viewBounds.left + "," + viewBounds.top + "/" +
viewBounds.right + "," +viewBounds.bottom);
The next challenge is to find a way to wait until the view has been
successfully rendered. Right now I'm using onEnterframe and I think
it's lagging a frame or two behind.
On Nov 12, 10:16 am, Mango <whiskers8...@yahoo.com> wrote:
> > Thank you for taking your time to help out, and for your example!
> > -Pete
> > On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> > > Rob and Peter both have the right idea. Unfortunately, when you add
> > > the view sprite to the parent, it inherits the parent's dimensions.
> > > Solution? Create two identical scenes, but only add one to the parent
> > > display object.
> > > Example:
> > >http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda > > > (Sorry about the hosting link. My site is not up currently, so I
> > > cannot host it properly. Also, the file upload on this site doesn't
> > > appear to load swfs. Feel free to rehost.)
> > > AS3:
> > > public class BoundTest extends Sprite {
> > > private var view:View3D;
> > > private var view2:View3D;
> > > private var cube:Cube;
> > > private var cube2:Cube;
> > > private var rect:Rectangle;
> > > public function BoundTest() {
> > > init();
> > > }
> > > trace(rect.width + ", " + rect.height);
> > > }
> > > }// of class
> > > On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > > > but it's giving me a bounding rectangle the size of the whole canvas.
> > > > Do you know what containers I could look at inside the object to get
> > > > something that matches the outline of our object?
> > > > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > > > Hey bakedbeing
> > > > > have you tried using the bounding radius property yet? you can access
> > > the
> > > > > containing radius of any object through the property boundingRadius.
> > > This
> > > > > doesn't give you a screen bounding box, but you could use a perspective
> > > > > calulation on the radius to get a view value and work from there.
> > > > > another quick hack that may be simpler to execute is just taking the
> > > > > rectangle returned from getBounds() on the view! this will give you a
> > > > > Rectangle instance that you can extract all relevant data relating to
> > > the
> > > > > bounds of the object inside.
> > > > > atb
> > > > > Rob
> > > > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com
> > > >wrote:
> > > > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > > > the actionscript API for google maps includes streetview yet, for
> > > that
> > > > > > you need to be using a browser and javascript as far as I can tell
> > > :(
> > > > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > I'm not sure if this is easier or more useful, but you can use
> > > the
> > > > > > > > Google Maps API for Flash, add the object to a sprite, and set
> > > the
> > > > > > > > sprite to the background of the view:
> > > > > > > > var view:View3D = new View3D(...);
> > > > > > > > var streetView:Sprite = //google street view API
> > > > > > > > view.background = streetView;
> > > > > > > > In this way, transparent space will not interfere with mouse
> > > clicks as
> > > > > > > > long as you're not using something that fills the entire view
> > > (fog
> > > > > > > > filter, etc).
> > > > > > > > Quote:
> > > > > > > > "The Google Maps API now provides a Street View service for
> > > obtaining
> > > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > > > I have no experience with street view or google maps, so this
> > > info may
> > > > > > > > be completely irrevalant or useless. :P
> > > > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > > Heya Mango, thanks for the response. Yeah I was thinking
> > > there's ways
> > > > > > > > > to do it using Matrix math and all the values in the render
> > > scene,
> > > > > > but
> > > > > > > > > it's well beyond me to do, and I was hoping that the data would
> > > be
> > > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > > > I'm overlaying a 3D object on Google Street View, and it's
> > > moving
> > > > > > > > > pretty well with the maps, but if you completely cover the
> > > streetview
> > > > > > > > > with another div with flash on it, you can't click and drag on
> > > the
> > > > > > > > > streetview below. So I need to calculate my bottle's position,
> > > render
> > > > > > > > > it, then move my view and move/crop my swf so it's only the
> > > size of
> > > > > > > > > the drawn 3D object :)
> > > > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > > Hello!
> > > > > > > > > > The data in these containers doesn't live long enough to
> > > access. I
> > > > > > > > > > don't think you can retrieve the properties of the objects
> > > without
> > > > > > > > > > inserting code into the Away3D classes (and the height and
> > > width
> > > > > > > > > > default to swf height and width anyway).
> > > > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > > > properties, and from these you can calculate with the
> > > projection
> > > > > > the
> > > > > > > > > > width and height of the drawn graphic. Unfortunately, I do
> > > not have
> > > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > > > I'm curious as to why you need these values, though. To what
> > > end
> > > > > > does
> > > > > > > > > > resizing the swf serve? :)
> > > > > > > > > > > Is there a way to access the graphics container in the
> > > view3D or
> > > > > > in
> > > > > > > > > > > the session object? Something that will give me access to
> > > the
> > > > > > sprite
> > > > > > > > > > > created for each object?
> > > > > > > > > > > > Is there a direct way to find a 2D bounding box for an
> > > object
> > > > > > as
> > > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > > > I want to find the top left and bottom right of the
> > > object, so
> > > > > > I can
> > > > > > > > > > > > crop my swf to just the edges of the object (move the
> > > view
> > > > > > object,
> > > > > > > > > > > > resize the swf).
> > > > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > > > view3D.
> > > > > > > > > > > > I was thinking a long way would be to draw the whole view
> > > to a
> > > > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that
> > > for
> > > > > > pixel
> > > > > > > > > > > > data, but I'm hoping there's something easier? A sprite
> > > object
> > > > > > inside
> > > > > > > > > > > > Projector who's x,y, height and width (in 2D) I can
> > > grab??
> > Thank you for taking your time to help out, and for your example!
> > -Pete
> > On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> > > Rob and Peter both have the right idea. Unfortunately, when you add
> > > the view sprite to the parent, it inherits the parent's dimensions.
> > > Solution? Create two identical scenes, but only add one to the parent
> > > display object.
> > > Example:
> > >http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda > > > (Sorry about the hosting link. My site is not up currently, so I
> > > cannot host it properly. Also, the file upload on this site doesn't
> > > appear to load swfs. Feel free to rehost.)
> > > AS3:
> > > public class BoundTest extends Sprite {
> > > private var view:View3D;
> > > private var view2:View3D;
> > > private var cube:Cube;
> > > private var cube2:Cube;
> > > private var rect:Rectangle;
> > > public function BoundTest() {
> > > init();
> > > }
> > > trace(rect.width + ", " + rect.height);
> > > }
> > > }// of class
> > > On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > > > but it's giving me a bounding rectangle the size of the whole canvas.
> > > > Do you know what containers I could look at inside the object to get
> > > > something that matches the outline of our object?
> > > > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > > > Hey bakedbeing
> > > > > have you tried using the bounding radius property yet? you can access
> > > the
> > > > > containing radius of any object through the property boundingRadius.
> > > This
> > > > > doesn't give you a screen bounding box, but you could use a perspective
> > > > > calulation on the radius to get a view value and work from there.
> > > > > another quick hack that may be simpler to execute is just taking the
> > > > > rectangle returned from getBounds() on the view! this will give you a
> > > > > Rectangle instance that you can extract all relevant data relating to
> > > the
> > > > > bounds of the object inside.
> > > > > atb
> > > > > Rob
> > > > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com
> > > >wrote:
> > > > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > > > the actionscript API for google maps includes streetview yet, for
> > > that
> > > > > > you need to be using a browser and javascript as far as I can tell
> > > :(
> > > > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > I'm not sure if this is easier or more useful, but you can use
> > > the
> > > > > > > > Google Maps API for Flash, add the object to a sprite, and set
> > > the
> > > > > > > > sprite to the background of the view:
> > > > > > > > var view:View3D = new View3D(...);
> > > > > > > > var streetView:Sprite = //google street view API
> > > > > > > > view.background = streetView;
> > > > > > > > In this way, transparent space will not interfere with mouse
> > > clicks as
> > > > > > > > long as you're not using something that fills the entire view
> > > (fog
> > > > > > > > filter, etc).
> > > > > > > > Quote:
> > > > > > > > "The Google Maps API now provides a Street View service for
> > > obtaining
> > > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > > > I have no experience with street view or google maps, so this
> > > info may
> > > > > > > > be completely irrevalant or useless. :P
> > > > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > > Heya Mango, thanks for the response. Yeah I was thinking
> > > there's ways
> > > > > > > > > to do it using Matrix math and all the values in the render
> > > scene,
> > > > > > but
> > > > > > > > > it's well beyond me to do, and I was hoping that the data would
> > > be
> > > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > > > I'm overlaying a 3D object on Google Street View, and it's
> > > moving
> > > > > > > > > pretty well with the maps, but if you completely cover the
> > > streetview
> > > > > > > > > with another div with flash on it, you can't click and drag on
> > > the
> > > > > > > > > streetview below. So I need to calculate my bottle's position,
> > > render
> > > > > > > > > it, then move my view and move/crop my swf so it's only the
> > > size of
> > > > > > > > > the drawn 3D object :)
> > > > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > > Hello!
> > > > > > > > > > The data in these containers doesn't live long enough to
> > > access. I
> > > > > > > > > > don't think you can retrieve the properties of the objects
> > > without
> > > > > > > > > > inserting code into the Away3D classes (and the height and
> > > width
> > > > > > > > > > default to swf height and width anyway).
> > > > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > > > properties, and from these you can calculate with the
> > > projection
> > > > > > the
> > > > > > > > > > width and height of the drawn graphic. Unfortunately, I do
> > > not have
> > > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > > > I'm curious as to why you need these values, though. To what
> > > end
> > > > > > does
> > > > > > > > > > resizing the swf serve? :)
> > > > > > > > > > > Is there a way to access the graphics container in the
> > > view3D or
> > > > > > in
> > > > > > > > > > > the session object? Something that will give me access to
> > > the
> > > > > > sprite
> > > > > > > > > > > created for each object?
> > > > > > > > > > > > Is there a direct way to find a 2D bounding box for an
> > > object
> > > > > > as
> > > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > > > I want to find the top left and bottom right of the
> > > object, so
> > > > > > I can
> > > > > > > > > > > > crop my swf to just the edges of the object (move the
> > > view
> > > > > > object,
> > > > > > > > > > > > resize the swf).
> > > > > > > > > > > > I couldn't find anything in the object3D properties or in
> > > > > > view3D.
> > > > > > > > > > > > I was thinking a long way would be to draw the whole view
> > > to a
> > > > > > > > > > > > bitmapData object with BitmapRenderSession and trawl that
> > > for
> > > > > > pixel
> > > > > > > > > > > > data, but I'm hoping there's something easier? A sprite
> > > object
> > > > > > inside
> > > > > > > > > > > > Projector who's x,y, height and width (in 2D) I can
> > > grab??
Hmm. If I remember correctly, you're overlaying a page with the swf,
and you need the swf to resize and reposition dynamically. How are you
communicating with the DOM to achieve this? It's possible that the
delay you're experiencing is caused by interaction between flash
player and the external scripts.
On Nov 11, 5:50 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> Heya gents, thanks for working so hard on that solution Mango, I'll
> have a good look through it this afternoon. As you mentioned above,
> after a morning of digging through the source I managed to figure out
> that the contents of the session.container object report their bounds
> as being flush with their edges, not the entire view. I'll post the
> code here for anyone who should come looking:
> Here's a way to use the Session object within your View3D to find the
> bounds of an object you've drawn to the screen with view.render().
> This example is built for a single object, in my case an imported OBJ
> file. The coordinates returned are relative to (this), the movie
> within which the view object is contained.
> // view has been defined previously, it's our View3D object.
> var sessionContainer:DisplayObjectContainer =
> view.session.getContainer(view) as DisplayObjectContainer;
> var drawnObject = sessionContainer.getChildAt(0);
> var viewBounds = drawnObject.getRect(this);
> trace("vb: " + viewBounds.left + "," + viewBounds.top + "/" +
> viewBounds.right + "," +viewBounds.bottom);
> The next challenge is to find a way to wait until the view has been
> successfully rendered. Right now I'm using onEnterframe and I think
> it's lagging a frame or two behind.
> On Nov 12, 10:16 am, Mango <whiskers8...@yahoo.com> wrote:
> > bakedbeing has also posted two great examples that use
> > session.getContainer() to find the bounds of a single object.
> > On Nov 11, 8:33 am, "Peter Kapelyan" <flashn...@gmail.com> wrote:
> > > That is really great!
> > > Can you add this example here please, I think it will help others:
> > > Thank you for taking your time to help out, and for your example!
> > > -Pete
> > > On Tue, Nov 11, 2008 at 1:49 AM, Mango <whiskers8...@yahoo.com> wrote:
> > > > Rob and Peter both have the right idea. Unfortunately, when you add
> > > > the view sprite to the parent, it inherits the parent's dimensions.
> > > > Solution? Create two identical scenes, but only add one to the parent
> > > > display object.
> > > > Example:
> > > >http://www.mediafire.com/?sharekey=c8a7966316f99e07d2db6fb9a8902bda > > > > (Sorry about the hosting link. My site is not up currently, so I
> > > > cannot host it properly. Also, the file upload on this site doesn't
> > > > appear to load swfs. Feel free to rehost.)
> > > > AS3:
> > > > public class BoundTest extends Sprite {
> > > > private var view:View3D;
> > > > private var view2:View3D;
> > > > private var cube:Cube;
> > > > private var cube2:Cube;
> > > > private var rect:Rectangle;
> > > > public function BoundTest() {
> > > > init();
> > > > }
> > > > On Nov 10, 6:46 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > Hey thanks for the tip Rob. I've tried using getBounds on the view,
> > > > > but it's giving me a bounding rectangle the size of the whole canvas.
> > > > > Do you know what containers I could look at inside the object to get
> > > > > something that matches the outline of our object?
> > > > > On Nov 8, 12:02 am, "Rob Bateman" <rob.bate...@gmail.com> wrote:
> > > > > > Hey bakedbeing
> > > > > > have you tried using the bounding radius property yet? you can access
> > > > the
> > > > > > containing radius of any object through the property boundingRadius.
> > > > This
> > > > > > doesn't give you a screen bounding box, but you could use a perspective
> > > > > > calulation on the radius to get a view value and work from there.
> > > > > > another quick hack that may be simpler to execute is just taking the
> > > > > > rectangle returned from getBounds() on the view! this will give you a
> > > > > > Rectangle instance that you can extract all relevant data relating to
> > > > the
> > > > > > bounds of the object inside.
> > > > > > atb
> > > > > > Rob
> > > > > > On Fri, Nov 7, 2008 at 5:42 AM, bakedbeing <danny.mcgill...@gmail.com
> > > > >wrote:
> > > > > > > Heya Mango, we were thinking the same here, but it doesn't look like
> > > > > > > the actionscript API for google maps includes streetview yet, for
> > > > that
> > > > > > > you need to be using a browser and javascript as far as I can tell
> > > > :(
> > > > > > > > On Nov 6, 10:15 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > I'm not sure if this is easier or more useful, but you can use
> > > > the
> > > > > > > > > Google Maps API for Flash, add the object to a sprite, and set
> > > > the
> > > > > > > > > sprite to the background of the view:
> > > > > > > > > var view:View3D = new View3D(...);
> > > > > > > > > var streetView:Sprite = //google street view API
> > > > > > > > > view.background = streetView;
> > > > > > > > > In this way, transparent space will not interfere with mouse
> > > > clicks as
> > > > > > > > > long as you're not using something that fills the entire view
> > > > (fog
> > > > > > > > > filter, etc).
> > > > > > > > > Quote:
> > > > > > > > > "The Google Maps API now provides a Street View service for
> > > > obtaining
> > > > > > > > > and manipulating the imagery used in Google Maps Street View!"
> > > > > > > > > I have no experience with street view or google maps, so this
> > > > info may
> > > > > > > > > be completely irrevalant or useless. :P
> > > > > > > > > On Nov 6, 9:24 pm, bakedbeing <danny.mcgill...@gmail.com> wrote:
> > > > > > > > > > Heya Mango, thanks for the response. Yeah I was thinking
> > > > there's ways
> > > > > > > > > > to do it using Matrix math and all the values in the render
> > > > scene,
> > > > > > > but
> > > > > > > > > > it's well beyond me to do, and I was hoping that the data would
> > > > be
> > > > > > > > > > somewhere in the 3D pipeline and just need to be fished out.
> > > > > > > > > > I'm overlaying a 3D object on Google Street View, and it's
> > > > moving
> > > > > > > > > > pretty well with the maps, but if you completely cover the
> > > > streetview
> > > > > > > > > > with another div with flash on it, you can't click and drag on
> > > > the
> > > > > > > > > > streetview below. So I need to calculate my bottle's position,
> > > > render
> > > > > > > > > > it, then move my view and move/crop my swf so it's only the
> > > > size of
> > > > > > > > > > the drawn 3D object :)
> > > > > > > > > > On Nov 7, 2:07 pm, Mango <whiskers8...@yahoo.com> wrote:
> > > > > > > > > > > Hello!
> > > > > > > > > > > The data in these containers doesn't live long enough to
> > > > access. I
> > > > > > > > > > > don't think you can retrieve the properties of the objects
> > > > without
> > > > > > > > > > > inserting code into the Away3D classes (and the height and
> > > > width
> > > > > > > > > > > default to swf height and width anyway).
> > > > > > > > > > > Object3D provides objectWidth, objectHeight, and objectDepth
> > > > > > > > > > > properties, and from these you can calculate with the
> > > > projection
> > > > > > > the
> > > > > > > > > > > width and height of the drawn graphic. Unfortunately, I do
> > > > not have
> > > > > > > > > > > the time (or knowledge, probably) to show you how to do this.
> > > > > > > > > > > I'm curious as to why you need these values, though. To what
> > > > end
> > > > > > > does
> > > > > > > > > > > resizing the swf serve? :)
> > > > > > > > > > > > Is there a way to access the graphics container in the
> > > > view3D or
> > > > > > > in
> > > > > > > > > > > > the session object? Something that will give me access to
> > > > the
> > > > > > > sprite
> > > > > > > > > > > > created for each object?
> > > > > > > > > > > > > Is there a direct way to find a 2D bounding box for an
> > > > object
> > > > > > > as
> > > > > > > > > > > > > finally drawn to the view?
> > > > > > > > > > > > > I want to find the top left and bottom right of the
> > > > object, so
> > > > > > > I can
> > > > > > > > > > > > > crop my swf to just the edges of the object