Away3D 4, MouseEvent3D UV > HitTestRenderer issue ?

118 views
Skip to first unread message

Leonerep

unread,
Nov 4, 2011, 10:46:36 AM11/4/11
to Away3D.dev
hi, i've test something simple and it doesn't work :/

(on Away3D 4.0.110915 Alpha)

i put a cube on a scene, make it interactive and test UV on Click.
3 face return a good UV.
3 face return 0,0.

pretty annoying :/

probably something wrong on HitTestRenderer ?

sample code :
public class Maintest extends Sprite
{
private var _view:View3D;
private var _cube:Cube;

public function Maintest()
{ if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
// entry point

_view = new View3D();
_view.width = 1200;
_view.height = 600;

var bitmaptest:BitmapData = new BitmapData(128, 128, false,
0xff0000);
for (var i:int = 0; i < 4; i++)
{
for (var j:int = 0; j < 4; j++ )
{
bitmaptest.fillRect(new Rectangle(i * 32, j*32, 32, 32),
Math.random() * 0xffffff);

}
}
_cube = new Cube(new BitmapMaterial(bitmaptest,true,true,true));
_cube.mouseEnabled = _cube.mouseDetails = true;
_cube.addEventListener(MouseEvent3D.CLICK, _onCubeClick);



addChild(_view);
_view.scene.addChild(_cube);
addEventListener(Event.ENTER_FRAME, _render);
}

private function _onCubeClick(e:MouseEvent3D):void
{
trace(">",e.uv);
}

private function _render(e:Event):void
{
_cube.rotationX += .3;
_cube.rotationZ += .2;
_view.render();
}
Reply all
Reply to author
Forward
0 new messages