Loader3D and lights

Software: Away3D 4.x

walken, Newbie
Posted: 20 December 2011 03:25 PM   Total Posts: 3

Hello friends smile

There is the problem whose turn me crazy…

I use Away 3D 4.

I load a model (.awd) with a Loader3D.
All is ok, model is here, texture too.
But I can’t find a way to apply light to this object.

I have see on the documentation : addLight()

But it looks like this method don’t existe on Away3D 4.

Is someone can help me please?

Thanks smile

   

John Wilson, Member
Posted: 21 December 2011 11:14 AM   Total Posts: 62   [ # 1 ]

After adding a light uou need to assign the light to the material of the object you have loaded.

b.lights = [light]; (where b is the BitmapMaterial

You’ll get an idea of how to do it by looking at in the Basic_LoadOBJ.as which you can get in the away3d-examples-fp11 download on GitHub.


   

walken, Newbie
Posted: 22 December 2011 10:35 AM   Total Posts: 3   [ # 2 ]

Ok, thanks for you answer.
I didn’t know that there is exemple on github :p

Btw i have found an other solution :

I have a loader called “padLoader”.
When the asset is loaded I execute a function where I do this :

var pad:Mesh = Mesh(loaderPad.getChildAt(0).getChildAt(0));
pad.material.lights = [l];

It’s not realy pretty but it’s working.

Thanks again for your reply.

Bye !

   

Avatar
Fabrice Closier, Administrator
Posted: 22 December 2011 11:03 AM   Total Posts: 1265   [ # 3 ]

LightHelper.addLightsToMaterials(objectContainer3D:ObjectContainer3D, lights:Vector.<LightBase> )

   

walken, Newbie
Posted: 22 December 2011 11:09 AM   Total Posts: 3   [ # 4 ]

That looks cool !
I’ll test it.

PS: @Fabrice Closier : Merci pour Prefab3d. C’est vraiment le top pour convertir mes modèles car je travaille sur Cinema4D et je n’ai jamais réussi à trouver de parser comme ceux pour les fichiers 3ds <3

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X