Is there any way to force the stacking order of an object?

1 view
Skip to first unread message

Joshua Granick

unread,
Dec 12, 2009, 2:58:13 PM12/12/09
to away3...@googlegroups.com
Hey guys,

I've noticed that when two objects are positioned close to each other, it
sometimes will throw off the stacking order. I have a series of objects
which are set on top of a floor. I am using a Plane for the floor, because
I like it to move as the camera moves. However, it would be great if I
could somehow force this to always be below the other objects.

Would I have to use a separate View3D object to do this, and synchronize
the cameras, or is there another way to set an object to always be below
the others?

Thank you!

Peter Kapelyan

unread,
Dec 12, 2009, 8:49:24 PM12/12/09
to away3...@googlegroups.com
Hi,

There's a few ways you can do this, one way is:

myFloor.pushBack=true;

and/or pushFront=true on the things you want on top.

Another way is to assign a large number for your Floors .screenZOffset property to force it always to be in back. In that case you will also need to set the Floors ownCanvas property to true.

Let me know if it works for you

-Pete
--
___________________

Actionscript 3.0 Flash 3D Graphics Engine

HTTP://AWAY3D.COM

Rob Bateman

unread,
Dec 22, 2009, 8:10:12 PM12/22/09
to away3...@googlegroups.com
Hey Joshua

have you tried using ownSession on 3d objects? the session of an object is used as its rendering container, a bit like viewportlayers in PV3D. only in this case, they can either be set to sort using the position of the object, or your own sorting position. for example:

var mySphere:Sphere = new Sphere();

mySphere.ownSession = new SpriteRenderSession();

would group your spheres rendered triangles into their own sprite layer, but sorting would stil lbe controlled by the view. however, doing this:

var mySphere:Sphere = new Sphere();

var mySession:SpriteRenderSession = new SpriteRenderSession();

mySession.screenZOffset = 10000;

mySphere.ownSession = mySession;

will ensure that the sorting level of the sphere will always be at 10000 units, which should place it behind all other 3D content in the view

hth!

Rob
--
Rob Bateman
Flash Development & Consultancy

rob.b...@gmail.com
www.infiniteturtles.co.uk
www.away3d.com

Joshua Granick

unread,
Dec 22, 2009, 11:10:54 PM12/22/09
to away3...@googlegroups.com
Each of your suggestions are all useful. Thank you very much for the help!

Michael Iv

unread,
Dec 23, 2009, 1:26:32 AM12/23/09
to away3...@googlegroups.com
Wow , Rob it was a very essential info you have brought along with this example , I mean why wouldn't you insert such example in tutorials page of Away3D site? many people ,especially those coming from PV3D are looking for this feature . I was one of these .

Thanks a lot !
--
Michael Ivanov ,Programmer
Neurotech Solutions Ltd.
Flex|Flash |Air |Games|OS|
Tel-0526237969
explo...@gmail.com
sup...@neurotech.co.il
Reply all
Reply to author
Forward
0 new messages