Sorry! I'm still not getting it. The code example you gave references
a movieclip on the stage (car_body_mc):

DAE_CarBody.materialLibrary.getMaterial("BodyDefault_png").material =
new
MovieMaterial(car_body_mc,{ precision:8, smooth:true,
interactive:true,
transparent:false,animated:false });

I want to set the default texture loaded with my collada to smooth. If
I use a movie clip on the stage as the texture for a model then I have
no problem setting that to smooth.

Here's a zip file with two models I have problems with (and the fla):
http://www.elyeball.pwp.blueyonder.co.uk/Problems.zip

I need the loudspeaker to have bothsides set to true and I want the
bumper to have a smooth texture. All your help is greatly appreciated!

BTW, I've just installed CS4 and now my project doesn't work at all! :-
( I don't know if this is a simple problem to fix?!?

Ian




On Nov 4, 12:35 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
> ok, i think i get it
>
> it sounds like your textures aren't loading in correctly from the collada
> file. This is usually because the filepaths aren't matching up in the
> collada, or autoLoadTextures is set to false.
>
> in both cases, the material property here:
>
> DAE_CarBody.materialLibrary.getMaterial("BodyDefault_png").material
>
> will not yet be set because that only occurs on the loading of a texture
> image (if the material is a bitmap material).
>
> so this will return null until it is set to something. if you try the
> following:
>
> DAE_CarBody.materialLibrary.getMaterial("BodyDefault_png").material =  new
> MovieMaterial(car_body_mc,{ precision:8, smooth:true, interactive:true,
> transparent:false,animated:false });
>
> then the material is reset to the correct moviematerial. This removes the
> need for setting the global material on a mesh - useful if there is more
> than one material defined in the collada object that need to be changed
> independently.
>
> hth!
>
> Rob
>
> On Mon, Nov 3, 2008 at 9:41 AM, Albinal <[EMAIL PROTECTED]> wrote:
>
> > Sorry Rob, forgot to answer your other question. I am changing the
> > texture of the car body by using a movie clip I have on the stage as a
> > texture which I am then applying to the model:
>
> > var TEXTURE_CarBody:MovieMaterial = new MovieMaterial(car_body_mc,
> > { precision:8, smooth:true, interactive:true, transparent:false,
> > animated:false });
>
> > So, at no point do I actually reference the default texture loaded
> > with the dae.
>
> > Cheers!
>
> > Ian
>
> > On Nov 3, 9:25 am, Albinal <[EMAIL PROTECTED]> wrote:
> > > Hi Rob,
>
> > > Yes, I am still having problems with getMaterial and yes, it's the
> > > same error. Here it is in full:
>
> > > TypeError: Error #1009: Cannot access a property or method of a null
> > > object reference.
> > >         at 3D_CAR_GAME_v4_fla::MainTimeline/frame1()
> > >  ! ------------- Begin Parse Collada -------------
> > >  ! ------------- Begin Parse Scene -------------
> > >  + Parse Node : Cube_019 : Cube_019
> > >  ! ------------- End Parse Scene -------------
> > >  ! ------------- No animations to parse -------------
> > >  + Parse Geometry : Cube_019-Geometry
> > >  + Parse MeshMaterialData
> > >  + Build Material : BodyDefault_png
> > >  + Build Mesh : Cube_019
>
> > > This is how I am trying to reference it:
> > > var myBitmapMaterial:BitmapMaterial =
> > > DAE_CarBody.materialLibrary.getMaterial("BodyDefault_png").material as
> > > BitmapMaterial;
> > > myBitmapMaterial.smooth = true;
>
> > > I tried accessing bothsides like this:
> > > var DAE_SR_LoudSpeaker:Object3DLoader = Collada.load("models/
> > > SR_LoudSpeaker.dae", {scaling:1.0, y:0, x:0, z:0, loadersize:300,
> > > bothsides:true});
>
> > > But got this:
> > > WARNING: Unused arguments: {bothsides:true}
>
> > > I don't know what you are saying Fabrice. Lines 340 and 347 relate to
> > > two menu buttons (buttonmode = true;)?!?
>
> > > Many thanks!
>
> > > Ian
>
> > > On Oct 31, 6:17 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
>
> > > > Hey Ian
>
> > > > not sure why your still having problems with getMaterial - are you
> > still
> > > > getting the "Cannot access a property or method of a null
> > > > object reference." error?
>
> > > > you seen to be managing to change the texture of the car body without
> > too
> > > > much difficulty - how are you accessing the material for that?
>
> > > > bothsides is a Mesh property, which is why setting it on a material
> > will
> > > > give you an error. You can set bothsides = true on all meshes contained
> > > > within the collada object by stepping through the children property on
> > you
> > > > collada objectcontainer3d returned from "handle" when the model has
> > finished
> > > > loading.
>
> > > > hth
>
> > > > Rob
>
> > > > On Fri, Oct 31, 2008 at 5:19 PM, Fabrice <[EMAIL PROTECTED]> wrote:
>
> > > > > try replace 2 lines
> > > > > away3d.core.render.AbstractRenderSession;
>
> > > > > line 340 & 347
> > > > > graphics.beginBitmapFill(bitmap, m, repeat, smooth && (v0x*(d2 - b2)
> > -
> > > > > v1x*d2 + v2x*b2 > 400));
>
> > > > > replace by
> > > > > graphics.beginBitmapFill(bitmap, m, repeat, true );
>
> > > > > Fabrice
>
> > > > > On Oct 31, 2008, at 5:30 PM, Albinal wrote:
>
> > > > >> Thanks Pete. They are not smooth enough! Here's the same project in
> > > > >> Papervision:
> > > > >>http://www.craniumcaviar.com/on_the_road/modify_your_motor/index.htm
>
> > > > >> Zoom in and look at the number plate in both and you will see the PV
> > > > >> one is much smoother. This is because I am telling it to set those
> > > > >> materials to smooth using GetMaterialByName. I can do the same thing
> > > > >> and set oneSide to false in PV.
>
> > > > >> Note: The PV one hangs at the start for some reason!?!?
>
> > > > >> Rob said I can do the same thing in Away3D using
> > > > >> materialLibrary.getMaterial("MyMaterialNameInDAE") but I just can't
> > > > >> get it to work! If anyone has an example of this working then I'd
> > love
> > > > >> to take a look at it. I am assuming if I can get this going I can do
> > > > >> the same with bothsides = true.
>
> > > > >> I tried that on the model:
> > > > >> DAE_SR_LoudSpeaker.bothsides = true;
>
> > > > >> But it gave a 1119 (access of undefined property) error!
>
> > > > >> I have also noticed that if you make the car big enough it
> > interferes
> > > > >> with the menu... but only if you are looking at the car
> > top-down!?!?!
> > > > >> If there isn't an easy answer then I will set a max size and lower
> > the
> > > > >> texture resolution.
>
> > > > >> Cheers.
>
> > > > >> Ian
>
> > > > >> On Oct 31, 4:06 pm, "Peter Kapelyan" <[EMAIL PROTECTED]> wrote:
>
> > > > >>> They are smooth, if you zoom in you will see.
>
> > > > >>> The problem is making a highres texture smaller and smooth on
> > screen-
> > > > >>> which
> > > > >>> is really hard...
>
> > > > >>> If you aren't going to make that car any bigger, I would suggest
> > making
> > > > >>> your
> > > > >>> texture smaller, then it will look smoother than it is now. Because
> > it
> > > > >>> looks
> > > > >>> better scaled up than down.
>
> > > > >>> The .bothsides=true property of a model makes is bothsided!
> > > > >>> It's looking awesome!
>
> > > > >>> -Pete
>
> > > > >>> On Fri, Oct 31, 2008 at 9:58 AM, Albinal <[EMAIL PROTECTED]>
> > > > >>> wrote:
>
> > > > >>>  Thanks Rob! You've been most helpful. This is what I am making:
>
> >http://www.craniumcaviar.com/on_the_road/modify_your_motor/away3d/ind
> > > > >>>> ...
>
> > > > >>>  It's getting close but I still can't figure out how to make the
> > > > >>>> textures smooth by default. I also need to make the loudspeaker
> > > > >>>> sunroof object have a two-sided texture?!?
>
> > > > >>>  Then I need to optimise all the textures (they are currently
> > PNGs),
> > > > >>>> sort out a loader and I'm done (I think?!?).
>
> > > > >>>  Ian
>
> > > > >>>  On Oct 30, 12:32 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
>
> > > > >>>>> Yay! I figured one out for myself. Instead of saying
> > myModel.visible =
> > > > >>>>>> true; I have to say myModel.handle.visible = true; Not sure why
> > > > >>>>>> though!?!
>
> > > > >>>  ah yes - i should explain that the "handle" property of an
> > > > >>>>> obejct3dloader
>
> > > > >>>> is
>
> > > > >>>>> like the "content" property of a native Loader class in flash. It
>
> > > > >>>> rpovides a
>
> > > > >>>>> direct reference to the assets being loaded, although beore
> > loading is
> > > > >>>>> complete the handle points to the loader itself so that
> > properties can
>
> > > > >>>> still
>
> > > > >>>>> be applied. On completion, the object3dloader removes itself
> > completely
>
> > > > >>>> form
>
> > > > >>>>> the scene (if it has alreay been attached, using the loaded
> > contents in
>
> > > > >>>> the
>
> > > > >>>>> handle to take it's place and passing on all it's properties.
> > This
> > > > >>>>> means
> > > > >>>>> that the object3dloader is no longer the parent of the content,
> > and so
> > > > >>>>> adjusting it's properties after loading will have zero effect.
> > Sorry
> > > > >>>>> for
>
> > > > >>>> the
>
> > > > >>>>> confusion!
>
> > > > >>>  atb
>
> > > > >>>  Rob
>
> > > > >>>   > On Thu, Oct 30, 2008 at 11:46 AM, Albinal <
> > [EMAIL PROTECTED]>
> > > > >>>> wrote:
>
> > > > >>>  Yay! I figured one out for myself. Instead of saying
> > myModel.visible =
> > > > >>>>>> true; I have to say myModel.handle.visible = true; Not sure why
> > > > >>>>>> though!?!
>
> > > > >>>  On Oct 30, 11:20 am, Albinal <[EMAIL PROTECTED]> wrote:
>
> > > > >>>>>>> Thanks Rob! I've got a few of the demo files and they are very
> > > > >>>>>>> helpful... I am working through them and reading as much stuff
> > as I
> > > > >>>>>>> can.
>
> > > > >>>  The debug stuff is working now which is great. It seems as though
> > I
>
> > > > >>>>>> am
>
> > > > >>>>> referencing the correct name so there must be something else
> > wrong:
>
> > > > >>>   ! ------------- End Parse Scene -------------
> > > > >>>>>>>  ! ------------- No animations to parse -------------
> > > > >>>>>>>  + Parse Geometry : Cube_019-Geometry
> > > > >>>>>>>  + Parse MeshMaterialData
> > > > >>>>>>>  + Build Material : BodyDefault_png
> > > > >>>>>>>  + Build Mesh : Cube_019
>
> > > > >>>  I am also loading some models in and then making them invisible.
> > > > >>>>>>> Unfortunately when I try and make them visible on a button
> > click it
> > > > >>>>>>> doesn't seem to work!?! The button is definately working as I
> > have a
> > > > >>>>>>> trace enabled.
>
> > > > >>>  The support for Away 3D is awesome. This group is very good and
> > the
> > > > >>>>>>> fact that you guys reply a lot is amazing. I have posted a few
> > things
> > > > >>>>>>> on a Papervision forum and responses are slow if you get one at
> > all.
>
> > > > >>>  Thanks very much!
>
> > > > >>>  Ian
>
> > > > >>>  On Oct 29, 3:11 pm, "Rob Bateman" <[EMAIL PROTECTED]> wrote:
>
> > > > >>>  Hey Ian
>
> > > > >>>  I expect the reason your debug isn't working is you're missing the
>
> > > > >>>>>>> correct
>
> > > > >>>>>>> import in the actionscript - cs3 helpfully ignores classes that
> > it
>
> ...
>
> read more »

Reply via email to