2192 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+14 more
mpc Volunteer moderator says

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) ?

271 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Located in Europe
+4 more
07happydays says

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); }

2192 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+14 more
mpc Volunteer moderator says

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 ?

271 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Located in Europe
+4 more
07happydays says

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);
2192 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+14 more
mpc Volunteer moderator says

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…

271 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $5,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Located in Europe
+4 more
07happydays says

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. :)

2192 posts
  • Has referred 200+ members
  • Has sold $500,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+14 more
mpc Volunteer moderator says

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 :D I will have to do that! :)

by
by
by
by
by
by