2199 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
+13 more
mpc 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); }

2199 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
+13 more
mpc 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);
2199 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
+13 more
mpc 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. :)

2199 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
+13 more
mpc 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! :)

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by