 package aerys.minko.scene.controller.debug
 {
+	import flash.utils.Dictionary;
+	
+	import aerys.minko.ns.minko_scene;
+	import aerys.minko.render.Effect;
 	import aerys.minko.render.geometry.primitive.CubeGeometry;
+	import aerys.minko.render.geometry.primitive.LineGeometry;
 	import aerys.minko.render.material.Material;
 	import aerys.minko.render.material.basic.BasicMaterial;
+	import aerys.minko.render.material.line.LineMaterial;
+	import aerys.minko.render.material.line.LineShader;
 	import aerys.minko.scene.controller.AbstractController;
 	import aerys.minko.scene.controller.mesh.skinning.SkinningController;
 	import aerys.minko.scene.node.Group;
+	import aerys.minko.scene.node.ISceneNode;
 	import aerys.minko.scene.node.Mesh;
 	import aerys.minko.type.enum.DepthTest;
+	import aerys.minko.type.enum.TriangleCulling;
 	import aerys.minko.type.math.Vector4;
-	
-	import flash.utils.Dictionary;
 	
 	public final class BonesDebugController extends AbstractController
 	{
 		private var _bonesThickness		: Number;
-		private var _material   		: Material;
+		private var _material   		: LineMaterial;
 		private var _targetToBonesMesh	: Dictionary = new Dictionary();
+		private var _numExtraDescendant	: uint 		 = 0;
 		
-		public function BonesDebugController(bonesThickness	: Number	= 0.02,
-											 bonesMaterial 	: Material 	= null)
+		public function BonesDebugController(bonesThickness		: Number		= 0.02,
+											 bonesMaterial 		: LineMaterial 	= null,
+											 numExtraDescendant	: uint 			= 0)
 		{
 			super(Mesh);
 			
+			_numExtraDescendant = numExtraDescendant;
 			initialize(bonesThickness, bonesMaterial);
 		}
 		
-		private function initialize(bonesThickness : Number, bonesMaterial : Material) : void
+		private function initialize(bonesThickness : Number, bonesMaterial : LineMaterial) : void
 		{
 			_bonesThickness = bonesThickness;
 			_material = bonesMaterial;
 			
 			if (!_material)
 			{
-				var bonesBasicMaterial : BasicMaterial = new BasicMaterial();
+				var bonesBasicMaterial : LineMaterial = new LineMaterial();
 				
-				bonesBasicMaterial.diffuseColor = 0x00ff00ff;
-				bonesBasicMaterial.depthWriteEnabled = false;
-				bonesBasicMaterial.depthTest = DepthTest.ALWAYS;
+				bonesBasicMaterial.effect = new Effect(new LineShader(null, -Number.MAX_VALUE));
+				bonesBasicMaterial.diffuseColor = 0xffe400ff;
+				bonesBasicMaterial.setProperty('depthWriteEnabled', false);
+				bonesBasicMaterial.setProperty('depthTest', DepthTest.ALWAYS);
+				bonesBasicMaterial.setProperty('triangleCulling', TriangleCulling.NONE);
 				_material = bonesBasicMaterial;
 			}
 			

			
			for (var i : uint = 0; i < numChildren; ++i)
			{
				var child : Group = joint.getChildAt(i) as Group;
				
				if (child != null)
				{
					var nextJointPosition 	: Vector4 	= child.transform.transformVector(
						Vector4.ZERO
					);

			var skinningCtrl : SkinningController = target.getControllersByType(SkinningController)[0]
				as SkinningController;
			
			for each (var boneMesh : Mesh in _targetToBonesMesh[target])
				boneMesh.parent = null;
			
