I'm having trouble using removeChild and addChild in Away3DLite.
I have an application with drag-and-drop components, and I want to move the
object you are dragging into its own View so that I can improve performance.
When all of the objects are in the same view, it eventually becomes too slow,
since I have to render the entire scene each frame. Instead, I am trying to
move the object you are dragging into its own View, render that View only, then
return it to the original View object.
This works okay for the first oject, but once I add a second object it throws an error.
Here is what the "offending" code looks like:
DraggingCanvas.scene.removeChild (event.instance.object);
Canvas.scene.addChild (event.instance.object);
Canvas.render ();
... and here is the error that it throws:
RangeError: Error #1125: The index 5 is out of range 5.
at
away3dlite.core.render::Renderer/collectPointFace()[C:\Development\Code
Library\External Libraries\Away3DLite\away3dlite\core\render\Renderer.as:115]
at
away3dlite.core.render::BasicRenderer/getFaceUnderPoint()[C:\Development\Code
Library\External
Libraries\Away3DLite\away3dlite\core\render\BasicRenderer.as:200]
at away3dlite.containers::View3D/fireMouseEvent()[C:\Development\Code
Library\External Libraries\Away3DLite\away3dlite\containers\View3D.as:210]
at away3dlite.containers::View3D/onRollOut()[C:\Development\Code
Library\External Libraries\Away3DLite\away3dlite\containers\View3D.as:168]
Does anyone understand what I could do to prevent this error, or does anyone
have another clever solution to keep the performance up while moving one object
in my scene?
Thanks!