How delete mesh from ObjectContainer3D?

Software: Away3D 4.x

Mafiy, Newbie
Posted: 20 August 2012 09:22 AM   Total Posts: 15

Hi,

How I can delete mesh from ObjectContainer3D by mesh name?

Add mesh to ObjectContainer3D by cycle.

//first iteration
mesh = new Mesh(planetexMaterial);
mesh.name "palne"
//second iteration
mesh = new Mesh(boxtexMaterial);
mesh.name "box";
mesh.100

//add to ObjectContainer3D

m_Scene.addChild(objectContainer.addChild(mesh)); 

How remove box?

   

parele, Jr. Member
Posted: 20 August 2012 12:39 PM   Total Posts: 43   [ # 1 ]

removeChild() will work just reference the location of the object…
or when adding object to scene/View put into an array as it will be easier to remove.
Than you will only need to remember its origin in the array.

   

Mafiy, Newbie
Posted: 30 August 2012 07:05 AM   Total Posts: 15   [ # 2 ]
private function addDObject(objectName:Stringx:uinty:uint):void
{
             
if (dynamicObject[x][y] != "")
 
{
  deleteDynamicObject
(xy);
 
}
var plane:PlaneGeometry = new PlaneGeometry(Grid.sizeGrid.size11);
var 
texMaterial:TextureMaterial = new TextureMaterial(new BitmapTexture(m_ResManager.getObject(objectName).frameTexture.getFrame(1)), truetruetrue);
texMaterial.diffuseMethod.alphaThreshold 1;
texMaterial.alphaBlending true;
   
m_DynamicMeshMap = new Mesh(planetexMaterial);
[strong]dynamicObject[x][y] m_DynamicMeshMap;[/strong] //Add to array
m_Scene.addChild(m_dynamicViewLayer.addChild(m_DynamicMeshMap));
}

public function deleteDynamicObject(x:uinty:uint):void
{
m_dynamicViewLayer
.removeChild(dynamicObject[x][y]);

[Fault] exception, information=Error: Parameter is not a child of the caller

   

parele, Jr. Member
Posted: 31 August 2012 12:46 AM   Total Posts: 43   [ # 3 ]

almost right,  its just you referenced it wrong…

for example:

MeshBox.x = 20; // if you can manipulate the object like this then you simply remove it the same way, check its location…

m_DynamicMeshMap = new Mesh(planetexMaterial);
[strong]dynamicObject[x][y] m_DynamicMeshMap;[/strong] //Add to array
m_Scene.addChild(m_dynamicViewLayer.addChild(m_DynamicMeshMap));//this method is weird
}

public function deleteDynamicObject(x:uinty:uint):void
{
m_Scene
.dynamicViewLayer.removeChild(m_DynamicMeshMap);//you wouldnt need the [x][y] i dont think flash cares where it is when you reference that object.

try along them lines , see if you can manipulate the object properties, either position, or “visible = false , or what have you Im thinking its a reference issue

If its in an array try remove child at index of eg: removeChild(myArray[1]);

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X