Finally figured this out.

I was generating a MovieClip, drawing it to a BitmapData object, then turning 
that into my material.

However, there's a much easier way if you change the scale of the material. I 
don't know how I missed this property before, but by far it's a better way to 
go:



public function setSize (instance:Object3D, scaleX:Number, scaleY:Number):void {
                
        var plane:Plane = instance as Plane;
        var material:MovieMaterial = plane.material as MovieMaterial;
        plane.width = objectWidth * scaleX;
        plane.height = objectHeight * scaleY;
        material.scaleX = 1 / scaleX;
        material.scaleY = 1 / scaleY;
                
}


This will crop the plane (center aligned) so long as the scale is greater than 
zero. I have checks elsewhere in my app which control the value so that's why I 
don't have a check in here. objectWidth and objectHeight are values elsewhere 
in the class which define the original size of the plane.


On Tue, 29 Dec 2009 12:13:41 -0800, Peter Kapelyan <[email protected]> wrote:

Whoops again, you wouldn't need a mask if you are just drawing that section
of the MovieClip...

However if the reason you really need MovieMaterial is because of
interactivity, I don't have any suggestions how that may work, sorry...

-Pete

On Tue, Dec 29, 2009 at 3:05 PM, Peter Kapelyan <[email protected]> wrote:

Whoops, Movie Material, that may be tough.

You might need to create a hidden MC with a mask that you control the size
according to the size of the plane, and draw just that part using draw().
Then you can take that bitmap and feed it to a BitmapMaterial each time your
plane changes size.

Let me know if it makes sense.

-Pete


On Tue, Dec 29, 2009 at 3:00 PM, Peter Kapelyan <[email protected]>wrote:

Offhand, an easy way may be to use a TransformBitmapMaterial and come up
with some calculation for the materials scaleX,Y and offsetX,Y, according to
the scale of the plane that you feed that calculation.

 If I had some time (I don't sorry) I would give it a shot, but I don't
think it should take more than 30 mins - an hour of messing with the
numbers.

Let me know if it works out for you.

-Pete



On Tue, Dec 29, 2009 at 1:06 PM, Joshua Granick <[email protected]
> wrote:

I want to resize a plane without squishing its material. Is there a way
to do that? I'm using a MovieMaterial. I'm okay with using a clipping mask
of some kind, but I'm not sure how to do that on an object level. I know how
to add a clipping mask for a View, but that doesn't help me in this case.

Thanks in advance for the help!




--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM




--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM



Reply via email to