|
| Removing mesh from 3d annotation |
 |
Tue, 15 Apr 2008 13:53:54 -070 |
I would like to know how to remove a mesh from a 3d annotation
have tried the following with a scene containing 2 meshes:
console.println(scene.meshes.count ); // echo's 2 to console
scene.meshes.removeByIndex(0);
scene.update;
console.println(scene.meshes.count ); // echo's 1 to console
however, both meshes are stil visible on screen
Any help would be much appreciated!
Thanks in advance,
|
| Post Reply
|
| Re: Removing mesh from 3d annotation |
 |
Tue, 22 Apr 2008 15:46:59 -070 |
W.,
There is a solution for your request. Yes, the current API does confuse
people on this issue. When you 'remove' a mesh from the scene, you are actually
only removing the mesh from the 'list' of scene items. You are not setting it's
visibility.
To set the mesh visibility, get the mesh object and set it's 'visible' property.
Here's a simple piece of code that uses the spacebar to toggle visibility on the
first mesh in the scene:
//====================================
//get target mesh
currMesh = scene.meshes.getByIndex(0);
currMesh.visible = false;
//toggle visibility with the spacebar
myKeyHandler = new KeyEventHandler();
myKeyHandler.onEvent = function(event)
{
if (event.characterCode == 32) //spacebar
{
currMesh.visible = !currMesh.visible;
}
}
runtime.addEventHandler(myKeyHandler);
|
| Post Reply
|
| Re: Removing mesh from 3d annotation |
 |
Tue, 22 Apr 2008 23:29:50 -070 |
Gary,
Thanks for the reply.
Toggeling visibility is helpful, but I want to remove the mesh from the
annotation. My end user will be able to ad and remove meshes from the
scene/annotation. So instead of making the meshes invisible, I want to remove
them, otherwise the meshes will stay in memory and are not used.
Thanks again.
|
| Post Reply
|
|
|
|
|
|
|
|
|
|