views:

373

answers:

2

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;

But this has no effect. Any help would be appreciated.

A: 

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 ?

George Profenza
myDisplayObject3D.autoCalcScreenCoords = true;trace(myDisplayObject3D.screen.x, myDisplayObject3D.screen.y);This pseudo code is pretty much the what I'm doing. I'm not sure if autoCalcScreenCoords is needed or not as it seems to have to effect either way. I've tried it on various objects and they all return 0. I have a feeling this issue is specific to version 2.0 and I'm sure it works fine in earlier versions (1.5)I'm trying to figure out if there is a new way of doing this in 2.0 or whether it is simply broken.
Groady
A: 

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.

Groady
cool! glad u got it working working.
George Profenza