Hello all,
First time poster here, so watch out
I’m having trouble getting MouseEvent3D working on an imported model.
The code I use is more or less taken from the beta 4 examples (The Ant and the Click event cubes)
The model loads fine, It’s exported from blender 2.6 as 3ds. The names, mesh, material, texture, all ok.
The Sign Plane is also working. It’s added, it has a red bound, and on hover the hand cursor
The loaded model shows the blue bounds around the mesh. Which leads me to belief I am doing something right, but on hover, nothing happens.
The only differences I can find in the the two approaches is that with the plane, I add it directly to the scene where as with the model, it is added to the loader, which is on the scene. But loader has no mouseEnabled or anything
Am I missing something or is , what I am try’n to do just not possible?
PS: I’m using Flex 4.6, FlashDevlop and the Swc download provided, I do not compile away3d myself
Any idea, pointers would be very much appreciated
Thanx
The main code parts use:
this is working
_sign = new Mesh(new PlaneGeometry(256, 128), _signMat);
...
_sign.addEventListener( MouseEvent3D.MOUSE_OVER, onMouseOver);
_sign.addEventListener( MouseEvent3D.MOUSE_OUT, onMouseOut);
_sign.mouseHitMethod = MouseHitMethod.MESH_CLOSEST_HIT;
_sign.mouseEnabled = true;
_sign.showBounds = true;
_sign.bounds.boundingRenderable.color = 0xff0000;
_scene.addChild(_sign);
This is only partially working
private function onAssetComplete(event:AssetEvent):void
{
if (event.asset.assetType == AssetType.MESH)
{
var m:Mesh = event.asset as Mesh;
m.castsShadows = true;
m.mouseEnabled = true;
m.addEventListener( MouseEvent3D.MOUSE_OVER, onMouseOver);
m.addEventListener( MouseEvent3D.MOUSE_OUT,onMouseOut);
m.mouseHitMethod = MouseHitMethod.MESH_ANY_HIT;
m.showBounds = true;
m.bounds.boundingRenderable.color = 0x0000ff;
}
}
The events, simplified but working
private function onMouseOver(event:MouseEvent3D):void
{
Mouse.cursor = "hand";
}
private function onMouseOut(event:MouseEvent3D):void
{
Mouse.cursor = "auto";
}