Reading corners, width, height from b2body

Hi there,

I am quite new to Box2dAS3. Unsurprisingly, I need a little help...

I have a b2Body-object. Now I want to determine its width, height, top-left corner and so forth.

I have been looking all over google, to no avail. I want to attach a prismatic joint to two objects, where one anchor is the top-middle of body1, and the other is the top-bottom of body2. At the same time I want to limit the movement to a range between the negative half-width of body1 and the positive half-width. I got the joint working, but am not sure how to determine these values...

Any help is greatly appreciated 🙂

TIA
toby
Well a bodies collision dimensions are made up from the shapes inside it.. so it sounds like you need to iterate over the shapes for the body and collect data that way. b2body has a function called getShapeList() which returns the first shape in the linked list( from which you can get shape.next and so on ). from the shape you can compute an aabb( axis aligned bounding box, sorry if its patronizing but I don't know what you know ). Keep track of the x's and y's from each aabb and you can figure out what you need. the angles you'll probably have to get vectors between your points and compute the angles that way. I'll check back later if you need help figuring out how to do that, I'm a bit pressed for time right now.
Hmm... okay. Thank you for your reply. I understand the basic principle. But maybe I am a bit dull:

Code:
/// Given a transform, compute the associated axis aligned bounding box for this shape.
/// @param aabb returns the axis aligned box.
/// @param xf the world transform of the shape.
public virtual function  ComputeAABB(aabb:b2AABB, xf:b2XForm) : void {};

b2AABB is what I want to find out, right? How do I use this method?

Cheers,
toby
Image

Pink rectangle is AABB 😉

Original thread: https://box2d.org/forum/viewtopic.php?t=2446