Posted By

babyC on 01/04/10


Tagged

Papervision3D pv3d


Versions (?)

PV3D Utils for calculating heights and width of DisplayObjects3D


 / Published in: ActionScript 3
 

Apparently you just can't get the height/width of a displayObject3D in Papervision3D. So here's a simple class that does exactly that for you!

  1. package com.nocreativity.pv3d.utils
  2. {
  3. import org.papervision3d.objects.DisplayObject3D;
  4.  
  5. public class ThreeDeeUtils
  6. {
  7. public static function getWidth(displayObject3D:DisplayObject3D):Number{
  8. return (displayObject3D.geometry.aabb.maxX - displayObject3D.geometry.aabb.minX)*displayObject3D.scaleX;
  9. }
  10. public static function getHeight(displayObject3D:DisplayObject3D):Number{
  11. return (displayObject3D.geometry.aabb.maxY - displayObject3D.geometry.aabb.minY)*displayObject3D.scaleY;
  12. }
  13.  
  14. }
  15. }

Report this snippet  

You need to login to post a comment.