This seems like it’s a bug in Away3D 4.x, but I’m posting here to get some sort of confirmation before I submit it to github. I am trying to add mouseOver and mouseOut events to a sprite3d object using a PickingColliderType.AS3_BEST_HIT, or really any collider type besides the default bounding box one, and I get null object exception errors when the event triggers.
_spriteMaterial = new ColorMaterial(0xe01f1f);
_spriteSquare = new Sprite3D(_spriteMaterial, 20, 5);
_spriteSquare.pickingCollider = PickingColliderType.AS3_BEST_HIT;
_spriteSquare.showBounds = true;
_spriteSquare.mouseEnabled = true;
_spriteSquare.addEventListener(MouseEvent3D.MOUSE_OVER, spriteSquare_mouseOver);
_spriteSquare.addEventListener(MouseEvent3D.MOUSE_OUT, spriteSquare_mouseOut);
private function spriteSquare_mouseOver(e:MouseEvent3D):void
{
trace("spriteSquare_mouseOver");
}
private function spriteSquare_mouseOut(e:MouseEvent3D):void
{
trace("spriteSquare_mouseOut");
}
When I trigger the mouseOver event I get a null object exception:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at away3d.entities::Sprite3D/collidesBefore()[C:Workspace4872-EW-Intuitysrcaway3dentitiesSprite3D.as:251]
at away3d.core.pick::RaycastPicker/getPickingCollisionVO()[C:Workspace4872-EW-Intuitysrcaway3dcorepickRaycastPicker.as:207]
at away3d.core.pick::RaycastPicker/getViewCollision()[C:Workspace4872-EW-Intuitysrcaway3dcorepickRaycastPicker.as:103]
at away3d.core.managers::Mouse3DManager/updateCollider()[C:Workspace4872-EW-Intuitysrcaway3dcoremanagersMouse3DManager.as:88]
at away3d.containers::View3D/render()[C:Workspace4872-EW-Intuitysrcaway3dcontainersView3D.as:676]
at App3DBase/update()[C:Workspace4872-EW-IntuitysrcApp3DBase.as:169]
at App3DBase/enterframeHandler()[C:Workspace4872-EW-IntuitysrcApp3DBase.as:278]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at away3d.core.managers::Stage3DProxy/notifyEnterFrame()[C:Workspace4872-EW-Intuitysrcaway3dcoremanagersStage3DProxy.as:92]
at away3d.core.managers::Stage3DProxy/onEnterFrame()[C:Workspace4872-EW-Intuitysrcaway3dcoremanagersStage3DProxy.as:579]
Am I doing something wrong with my implementation, or is this really a bug?