Wheres getWidth(), getHeight() or getDepth() for spatials?

I was debating whether to post this, as my first real thread topic, but ill do it anyways :P. I constantly find myself using these to find the height and widths.



[java]Vector3f extent = ((BoundingBox) spatial.getWorldBound()).getExtent(new Vector3f());

float x = ( (BoundingBox)spatial.getWorldBound()).getXExtent();

float y = ( (BoundingBox)spatial.getWorldBound()).getYExtent();

float z = ( (BoundingBox)spatial.getWorldBound()).getZExtent();[/java]



I have even extended Picture for my UI just so I can add the getXXX functions. So I was just wondering why these functions aren’t standard for spatials? Pictures even have height and width attributes >_<, why not just return those for Pictures?



I haven’t looked into it too much, so sry if this isn’t a good question



Thanks

Wez

1 Like

You can get these values via the worldBounds:

((BoundingBox)spatial.getWorldBound()).getXXX()

Think about it, a geometry can be any kind of mesh, so the info always depends on some bounding volume.

2 Likes

ah well that’s better :P, I never really looked at it properly, I just took it from the wiki. But i was thinking more like spatial.getWidth() just to simplify it

width isnt really meaning anything, its relative

1 Like

yeh that true. But what about for Pictures? which even have width and height attributes. Which is the real reason i made this, trying to sort out my UI

Hi Wesley and Normen, thanks for this information and sorry for refreshing a VERY old topic :stuck_out_tongue: Found it useful in the process of aiming/picking at objects on the scene.