Getting 2D screen coordinates of a 3D object in Papervision 2.0
How do I get the 2D screen coordinates of a 3D object when using Papervision 2.0 (Great White)? I've read that following properties should return the screen coords but these always return 0.
myDisplayObject3D.screen.x
myDisplayObject3D.screen.y
I've also tried setting:
myDisplayObject3D.autoCalcScreenCoords = true;
Bu开发者_Python百科t this has no effect. Any help would be appreciated.
Turns out I was attempting to read the values immediately after adding the object to the scene but BEFORE the renderers next render cycle. I added the above code to my enter frame listener and all subsequent traces worked correctly.
screen.x and screen.y should work. Is your 3d object added to the scene ?
In the online articles(pv3d.org, everydayflash) all looks fine.
Could you post a snippet ( either isolate the bit of code, either write a simple analogy to your situation) so we can get a clue of what might be wrong ?
精彩评论