- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
Hi guys, I have a question, I want to load a 3D human model into papervision and then when someone clicks different parts of the human body things will happened…. Loading a 3D model is easy but any idea how to make different parts active (addEventListener) ?
You must do something like this:
var child : DisplayObject3D = object.getChildByName(“mesh”, true); child.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, objectClickHandler, false, 0, true);
Or something like this for all:
for each(var child : DisplayObject3D in obj.children) { child.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, objectClickHandler, false, 0, true); }
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
flashanctuary said
You must do something like this:var child : DisplayObject3D = object.getChildByName(“mesh”, true); child.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, objectClickHandler, false, 0, true);
Or something like this for all:
for each(var child : DisplayObject3D in obj.children) { child.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, objectClickHandler, false, 0, true); }
Yeah ok but how can I divide the mesh into sections, so I can add different listener to different parts of the body ?
Maybe this will help you.
function daeLoadHandler(event : Event) : void { var daeInstance = event.target; }
for(var name : String in daeInstance.children)
{
var mesh = daeInstance.getChildByName(name);
}
for(var name:String in mesh.materials.materialsByName)
{
var meshMaterial : MaterialObject3D = mesh.materials.materialsByName[name];
meshMaterial.interactive = true;
}
mesh.addEventListener(InteractiveScene3DEvent.OBJECT_CLICK, animateDae, false, 0, true);- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
Thanks for that, I am not really looking into coded solution just wanted to hear from you, as far as I know when you load a 3D model it is recognize as one single object so it is hard to determine what part of it was clicked…
Yes, but if you will divide your dae object into sub-objects and you will give them names in maya, 3d studio or whatever, you can use this solution. 
- Sold between 250 000 and 1 000 000 dollars
- Exclusive Author
- Community Moderator
- Author was Featured
- Bought between 10 and 49 items
- Referred between 200 and 499 users
- Has been a member for 4-5 years
- Won a Competition
flashanctuary said
Yes, but if you will divide your dae object into sub-objects and you will give them names in maya, 3d studio or whatever, you can use this solution.![]()
Oh this is great
I will have to do that! 
