lastRenderList in Away3D?

Software: Away3D 3.x

Targo, Newbie
Posted: 13 September 2011 08:34 AM   Total Posts: 1

Hi,

    I’m new to Away3D and I’m trying to develop a panoramic view and a few hotspots placed on some faces of the Skybox. I need to know which faces of the Skybox are rendered when I move the camera around it, that is, which faces are currently visible on the viewport (View3D) in order to check which hotspots are visible and get their 2D position. I used to work with PV3D and there was a property inside PV3D Viewport3D class called lastRenderList, which provided the
information of the renderable litems list in the last pass, so my question is how can I get this information in Away3D?

I saw another post in the list that talked about how to implement hotspots in a Skybox panoramic view but I couldn’t get so much useful information for my needs.

Another question is how can I get 2D position of a given point in uv coordinates?

Any help would be appreciated.

Thanks a lot in advance!

   

Avatar
Alejandro Santander, Administrator
Posted: 13 September 2011 02:30 PM   Total Posts: 414   [ # 1 ]

Hey Targo,

For this kind of problem I would use the camera.screen() method. This returns the screen coordinates of a 3d point in the scene, which answers your second question. By comparing these coordinates with the dimensions of your view port, you can easily determine if your object is viewable or not at a given moment.

http://www.lidev.com.ar/tests/away3d/skybox_hotspots/

In the example I am placing a red cube at a far “skyboxy” position:

cube = new Cube();
cube.x = 100000;
cube.y = 100000;
cube.z = 100000;
cube.material = new ColorMaterial(0xFF0000);
view.scene.addChild(cube);

And then creating a green regular Sprite in order to track its 2D position on screen:

tracer = new Sprite();
tracer.graphics.beginFill(0x00FF00);
tracer.graphics.drawCircle(0, 0, 5);
tracer.graphics.endFill();
addChild(tracer);

And on enterframe:

var sv:Vector3D = view.camera.screen(cube);

tracer.x = sv.x + stage.stageWidth/2;
tracer.y = sv.y + stage.stageHeight/2;

if(tracer.x > 0 && tracer.x < stage.stageWidth && tracer.y > 0 && tracer.y < stage.stageHeight)
tf.text = “in view”;
else
tf.text = “not in view”;

The screen method returns the screen coordinates of the cube and sets that to the sprite. I’m adding the stage width and height over 2 because that is the position of my view.

Let me know if that does the trick for you.

Good luck!

   

Targo, Newbie
Posted: 13 September 2011 03:47 PM   Total Posts: 1   [ # 2 ]

Thanks a lot Alejandro for the detailed explanation!! I will test your solution and see if it works for me.

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X