Away3dLite face material error

4 views
Skip to first unread message

savagelook

unread,
Sep 24, 2010, 3:10:03 PM9/24/10
to Away3D.dev
Whenever I try to change the material of a particular face in the
latest version of away3dlite I get the following error when I execute
render():

RangeError: Error #1125: The index 0 is out of range 0.
at away3dlite.containers::Scene3D/removeSceneMaterial()[C:\development
\away3dlite_3ds\src\away3dlite\containers\Scene3D.as:36]
at away3dlite.core.base::Mesh/buildMaterials()[C:\development
\away3dlite_3ds\src\away3dlite\core\base\Mesh.as:166]
at away3dlite.core.base::Mesh/project()[C:\development\away3dlite_3ds
\src\away3dlite\core\base\Mesh.as:72]
at away3dlite.containers::ObjectContainer3D/project()[C:\development
\away3dlite_3ds\src\away3dlite\containers\ObjectContainer3D.as:65]
at away3dlite.containers::Scene3D/project()[C:\development
\away3dlite_3ds\src\away3dlite\containers\Scene3D.as:94]
at away3dlite.containers::View3D/render()[C:\development
\away3dlite_3ds\src\away3dlite\containers\View3D.as:534]
at away3dlite_3ds/_onEnterFrame()[C:\development\away3dlite_3ds\src
\away3dlite_3ds.as:53]

Here's a simple test case that will cause the above error to happen:

package
{
import away3dlite.cameras.HoverCamera3D;
import away3dlite.containers.Scene3D;
import away3dlite.containers.View3D;
import away3dlite.materials.ColorMaterial;
import away3dlite.primitives.Cube6;
import away3dlite.primitives.Plane;

import flash.display.Sprite;
import flash.display.StageQuality;
import flash.events.Event;

[SWF(frameRate="60", height="600", width="800",
backgroundColor="0x000000")]
public class away3dlite_3ds extends Sprite
{
private var _view:View3D;
private var _camera:HoverCamera3D;

public function away3dlite_3ds()
{
if (stage) {
_init();
} else {
this.addEventListener(Event.ADDED_TO_STAGE, function(e:Event):void
{ _init(); });
}
}

private function _init():void {
stage.quality = StageQuality.LOW;

_camera = new HoverCamera3D();
_camera.distance = 300;
_camera.tiltAngle = 10;

_view = new View3D(new Scene3D(), _camera);
_view.x = stage.stageWidth/2;
_view.y = stage.stageHeight/2;
this.addChild(_view);

var plane:Plane = new Plane(new ColorMaterial(0xffffff), 200, 200,
2, 2);
plane.bothsides = true;
_view.scene.addChild(plane);

plane.faces[0].material = new ColorMaterial(0xff0000);

this.addEventListener(Event.ENTER_FRAME, _onEnterFrame);
}

private function _onEnterFrame(e:Event):void {
_camera.panAngle -= 1;
_camera.hover();
_view.render();
}
}
}

John Brookes

unread,
Sep 24, 2010, 6:27:48 PM9/24/10
to away3...@googlegroups.com
Maybe
_view.render();
just before
plane.faces[0]...

savagelook

unread,
Sep 27, 2010, 12:49:09 PM9/27/10
to Away3D.dev
No luck with that. Is this is a new bug? I feel like I've changed
the material on faces in the past in Away3dLite without running into
this error.

On Sep 24, 6:27 pm, John Brookes <jbp...@googlemail.com> wrote:
> Maybe
> _view.render();
> just before
> plane.faces[0]...
>

katopz

unread,
Sep 27, 2010, 1:01:35 PM9/27/10
to away3...@googlegroups.com
like this?

http://away3d.googlecode.com/svn/branches/lite/bin/ExFaceClick.swf

http://away3d.googlecode.com/svn/branches/lite/src/interactives/ExFaceClick.as

hth
--
Regards
-----------------------------------------------------------
Todsaporn Banjerdkit, katopz, http://sleepydesign.com
Away3DLite and JigLibFlash Developer Team

John Brookes

unread,
Sep 27, 2010, 1:56:26 PM9/27/10
to away3...@googlegroups.com
Well savagelooks code above throws an error for me, but if I put _view.render(); after the plane is created I dont get the error.

The example Kaptopz posted also throws the same error for me.

Latest from svn lite.
4.1 sdk
flash develop

savagelook

unread,
Sep 27, 2010, 2:00:23 PM9/27/10
to Away3D.dev
katopz, I tried your code too and I still get the error

On Sep 27, 1:01 pm, katopz <kat...@gmail.com> wrote:
> like this?
>
> http://away3d.googlecode.com/svn/branches/lite/bin/ExFaceClick.swf
>
> http://away3d.googlecode.com/svn/branches/lite/src/interactives/ExFac...
>
> hth
> Todsaporn Banjerdkit, katopz,http://sleepydesign.com

katopz

unread,
Sep 27, 2010, 2:12:37 PM9/27/10
to away3...@googlegroups.com
are you guys sure that you use libs here?
seem fine to me...

http://away3d.googlecode.com/svn/branches/lite/libs

hth
Todsaporn Banjerdkit, katopz, http://sleepydesign.com

John Brookes

unread,
Sep 27, 2010, 2:31:48 PM9/27/10
to away3...@googlegroups.com
Using Away3D\trunk\fp10\Away3DLite\src
Are we supposed to use the branches?

savagelook

unread,
Sep 27, 2010, 3:50:37 PM9/27/10
to Away3D.dev
I'm also using the latest trunk, not the branches.

On Sep 27, 2:31 pm, John Brookes <jbp...@googlemail.com> wrote:
> Using Away3D\trunk\fp10\Away3DLite\src
> Are we supposed to use the branches?
>
> On 27 September 2010 19:12, katopz <kat...@gmail.com> wrote:
>
>
>
> > are you guys sure that you use libs here?
> > seem fine to me...
>
> >http://away3d.googlecode.com/svn/branches/lite/libs
>
> > hth
>

katopz

unread,
Sep 27, 2010, 10:02:04 PM9/27/10
to away3...@googlegroups.com
Are we supposed to use the branches?
yes please


I'm also using the latest trunk, not the branches.
try change to branches for this face issue, like john said you need to call render before change face material for trunk, but it's work in certain case, this issue is fixed in branches

hth
 
Todsaporn Banjerdkit, katopz, http://sleepydesign.com
Reply all
Reply to author
Forward
0 new messages