Closed Tortenazor closed 10 years ago
PickingTechnique.RAYCASTING_BOX works with Orthographic Camera. Pixel Picking doesn't seem to be working, we'll look into it.
Finally I found the time to fix it myself. Here it goes:
// update picking projection to get the picked pixel in (0, 0) var projection : Matrix4x4 = _sceneData.pickingProjection;
projection.lock();
scene.activeCamera.getProjection(projection);
if(scene.activeCamera is OrthographicCamera) {
var o:OrthographicCamera = scene.activeCamera as OrthographicCamera
projection.prependTranslation(-_mouseX / o.zoom , _mouseY / o.zoom ,0)
} else {
var rawData : Vector.<Number> = projection.getRawData();
rawData[8] = (-_mouseX / viewport.width) * 2.;
rawData[9] = (_mouseY / viewport.height) * 2.;
projection.setRawData(rawData);
}
projection.unlock();
To reproduce, modify Pickingexample.as so it uses an orthogonal camera instead of the default one:
override protected function initializeScene() : void { super.initializeScene();
... ...
I think the issue should be somewhere in PickingController.as between lines 360 and 370 because the projection matrix is used there.