My favorites | Sign in
Project Logo
                
Search
for
Updated Oct 01, 2008 by jwopitz
Labels: Featured, Phase-Implementation, tutorial
as3isolib_tutorial_002  
Learn to use an IsoScene to layout objects in 3D isometric space.

tutorial

IsoScene is a container-type node that allows multiple IIsoDisplayObject children to be added. If the layout is enabled, the IsoScene will depth sort each child according to their 3D isometric coordinates, regardless of the order they were added.

code

package 
{
	import as3isolib.display.primitive.IsoBox;
	import as3isolib.display.scene.IsoScene;
	
	import flash.display.Sprite;
	
	public class IsoApplication extends Sprite
	{
		public function IsoApplication ()
		{
			var box0:IsoBox = new IsoBox();
			box0.setSize(25, 25, 25);
			box0.moveTo(200, 0, 0);
			
			var box1:IsoBox = new IsoBox();
			box1.width = 10;
			box1.length = 25;
			box1.height = 50;
			box1.moveTo(230, -15, 20);
			
			var box2:IsoBox = new IsoBox();
			box2.setSize(10, 50, 5);
			box2.moveTo(200, 30, 10);
			
			var scene:IsoScene = new IsoScene();
			scene.hostContainer = this;
			scene.addChild(box2);
			scene.addChild(box1);
			scene.addChild(box0);
			scene.render();
		}
	}
}

IsoScene also has the ability to disregard the isometric layout which will depth sort each child according to the order they were added. This feature is available for developers wishing to have a custom layout scheme.

code

scene.layoutEnabled = false;

Comment by alexander.dehaas, Oct 18, 2008

getting error: IEventDispatcherProxy not found ... line 34 in as3isolib/data > INode.as ... maybe this doesn't belong here, but i am not developer enough yet to join for debug testing, etc. ; ) - just wanted to build this cube, doesn't work ... i build in flex 3. thanks for any info on this!

Comment by djhalon, Nov 01, 2008

In the most current Alpha 2008.10.19 the shadow is not being rendered by the scene. Is this an expected change or a new property?

Comment by jwopitz, Nov 19, 2008

@alexander.dehass If you are just bringing in the source code into your project, you might double check to make sure you also copied over the eDpLib package in addition to the as3isolib package. Otherwise I would suggest using the SWC (especially if you are using Flex Builder).

@djhalon By default the DefaultShadowRenderer? will only draw objects whose z > 0. I would need to see your implementation in order to assess the problem.

Comment by jwopitz, Nov 19, 2008

@djhalon I would also look at http://code.google.com/p/as3isolib/wiki/as3isolib_tutorial_006 since by default an IsoScene? does not have any style renderers assigned.

Comment by danko.kozar, Mar 11, 2009

My compliments first! The framework is really cool!! :-)

I wonder is it possible to split a character into two parts (upper and lower box), moving them together as one object but sorting them separately in the display list?

Yes, I realize that each IsoPrimitive? is actually an IsoContainer? I can add children to it, but I'd like to have some flag that should tell the system that it should sort its children separately.

Why do I need this? Because isometric sort is not perfect and cannot sort situations like this: So, if a character is 2 boxes tall, there can be problems.

Thanks! :-)

Danko

Comment by krixware, Apr 19, 2009

Again, as noticed by djhalon, shading is not present -- I'm using 200902051239 (beta release ver 1.0).zip

---

I was intrigued by what danko.kozar's comment. I was trying to achieve

but I only got malformed ISO.

And when I did a closer look the rendering engine has some anomalies:

Click image to view larger

Source code to above:

package {
  import as3isolib.display.primitive.IsoBox;
  import as3isolib.display.scene.IsoScene;
    
  import flash.display.MovieClip;
  
  public class IsoApplication2 extends MovieClip {
    var box0:IsoBox;
    var box1:IsoBox;
    var box2:IsoBox;
    var scene:IsoScene;
    
    public function IsoApplication2() {
      box0 = new IsoBox();
      box0.setSize(50, 25, 25);
      box0.moveTo(200, 0, 0);
      
      box1 = new IsoBox();
      box1.width = 25;
      box1.length = 50;
      box1.height = 25;
      box1.moveTo(249, 24, 0); // <--- noticed 249 instead of 250? and noticed 24 instead of 25?
      
      box2 = new IsoBox();
      box2.setSize(25, 25, 50);
      box2.moveTo(249, 73, 24); // <--- also noticed 73 instead of 75?
      
      scene = new IsoScene();
      scene.hostContainer = this;
      scene.addChild(box2);
      scene.addChild(box1);
      scene.addChild(box0);
      scene.render();
    }
  }
}
Comment by tensilecolt, Jul 20, 2009

It doesn't seem to render the shadow, don't know if this has something to do with the case that I am using Flex Builder 3.

- Kevin

Comment by jwopitz, Jul 28, 2009

Sorry folks, I don't get notifications of comments here. Instead try using the user group as I do get notified of each new comment.

As for the shadow rendering issue, can you post a bug and I will take a look.

@danko I have considered doing something similar to what you are suggesting where it hacks the parenting of the object and splits it however I have not thought of a good implementation. One idea was to implement an additional sizing API so that it draws a certain size but during sorting it retains the forced sizing. Any thoughts on this are welcome.

@Kevin (tensilecolt) Using FB3 vs Flash IDE should make no difference.


Sign in to add a comment
Hosted by Google Code