Last active
October 6, 2015 14:33
-
-
Save SirGordon/e3622e7cf4de3d99640e to your computer and use it in GitHub Desktop.
away3d get screen coords of 3d object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function getStagePosition(cam:Camera3D, obj:ObjectContainer3D):Vector3D { | |
var camT:Matrix3D = cam.viewProjection.clone(); | |
var planT:Matrix3D = obj.sceneTransform.clone(); | |
planT.appendTranslation(0, obj.maxY, 0); | |
camT.prepend(planT); | |
var pv:Vector3D = Utils3D.projectVector(camT, new Vector3D()); | |
pv.x = (pv.x * stage.stageWidth / 2) + stage.stageWidth / 2; | |
pv.y = (pv.y * -1 * stage.stageHeight / 2) + stage.stageHeight / 2; | |
return pv; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment