0

my question is: how can I resize an ObjectContainer3D instance (as it doesn't have "width", "height" and "depth" properties)?

jetpack01
  • 71
  • 1
  • 7

2 Answers2

0

Maybe you can use 'scaleX', 'scaleY', 'scaleZ', or 'scale'.

Note that this will chance the size of the objects in the ObjectContainer3D within the 3D space. Not sure if that's what you're trying to do, given that 3D objects have width, height & depth.

  • Hi, thank you for your answer. Of course I could use something like this: `container.scaleX = container.scaleY = container.scaleZ = 0.9;` ...but I just need a fixed size in pixel, just like: `container.width = container.height = container.depth = 500;` – jetpack01 Mar 07 '13 at 12:07
  • Anyway.. Inside my ObjectContainer3D object I have 6 Mesh objects. It's just a cube made of 6 different planes; each plane is created this way: `var plane:Mesh = new Mesh(planeGeometry, new TextureMaterial(Cast.bitmapTexture(cubeFace_bd)));` ...but Mesh objects also don't have width, height & depth properties! :( – jetpack01 Mar 07 '13 at 12:29
  • Mesh also has scale/scaleX/scaleY/scaleZ. As Jerome noted in his post, the size of the object on the screen is affected by it's distance from the camera. I'd also add that the camera type & settings affect the final display size. – drswebdev Mar 07 '13 at 20:15
  • Depending on what you're trying to do, you may like to try using a different camera lens. In a case where I wanted to display an object at a specific size in pixels, I used an OrthographicLens... – drswebdev Mar 07 '13 at 20:16
  • The size of the Away3D view (which is in pixels, and has width/height) also affects the size of the objects when they are displayed on the screen. Not sure if the above helps. I think your confused by the difference between how the 3D objects are sized/positioned in the Away3D view in 3D, and how the final result appears on the screen in 2D. – drswebdev Mar 07 '13 at 20:26
  • Maybe this tutorial will help? [link](http://www.flashmagazine.com/Tutorials/detail/away3d_4_basics_-_the_view_and_the_scene/) – drswebdev Mar 07 '13 at 20:51
0

In 3D space there is no concept of pixels. Usually the size is in "units". What you are looking for is a way to render pixel perfect textures. So a pixel mapped onto the 3D object renders as a pixel on screen. This is usually achieved by moving the object at a specific distance from the camera.

Here's a link to a blog post I found on the subject that should point you in the right direction.

In the end the size of the actual 3D object doesn't matter. What matter is the scale and mainly the aspect ratio to render texture as needed. To render a 400px by 200px texture on screen, the 3D plane can be 4 units by 2 units. After that positioning it correctly in front of the camera will produce a 400px by 200px image on screen.

hth.

J.