You are hereForums / Papervision3D / Question and Answer / Collada Interactivity

Collada Interactivity


By dpm909 - Posted on 22 July 2008

I'm trying to get mouse over events from a collada; ideally from the materials. I'm using MovieMaterials, with interactivity set to true for the materials as well as the BasicView. The collada file loads properly, and the MovieMaterials display ok. Getting mouse events from movie materials applied to primitives worked fine, but apparently doesn't work with Colladas? This is the short version:
  1. mc0 = new Material0(); //class name of library MC in flash IDE
  2. mc0.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
  3.  
  4. material0 = new MovieMaterial(mc0, true, true, true);
  5. material0.doubleSided = true;
  6. material0.interactive = true;
  7. material0.animated = true;
  8.  
  9. var materialsList:MaterialsList = new MaterialsList();
  10. materialsList.addMaterial(material0, "material0");
  11.  
  12. ball = new Collada("buckyBall.dae", materialsList, .1);
  13. scene.addChild(ball);
  14.  
  15.  
  16.  
  17. function onMouseOver(event:MouseEvent):void
  18. {
  19. trace("you rolled:"+event.target.name+"currentTarget:"+event.currentTarget.name);
  20. }
  21.  
  22. [... render scene ...]
The problem was using BasicView. I had it set to interactive=true, but by removing BasicView and putting in the scenes3D, camera, renderer, etc., it worked.
No need to stop using BasicView...in your constructor you could just go... public class MyClass extends BasicView { public function MyClass(){ super(640,480, true, true); } } ... :)