PV3D Utils for calculating heights and width of DisplayObjects3D


/ Published in: ActionScript 3
Save to your folder(s)

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!


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.