Retrieving Object X and Y width

Are there any P3D APIs that return the x width and y width of an object (in pixels/steps/coords, ect)?


Are you on your own, again?

You mean when rendered on screen? You can get a pretty good idea if you get the tight bounds of the model, and use lens.project to project the corner points onto the screen to get the 2D coordinates. Then you get the min and max of these 8 2D coordinates.

No, not in a 2D render, just in 3D space. For instance, if you had a Block in your 3D world and you wanted to know how much 3D space that block is taking up on the x and y; and then somehow convert that to steps/coords/pixels, etc.

In other words, if that Block’s Xsize was (0-30, 0+30) and its Ysize was (0-40, 0+40), you can easily see its dementions (x,y) in the 3D space, according to its starting x,y position, which in this case the starting position is (0,0).

That’s the data I would like to retrieve if it’s possible.

In that case, just use something like:

a, b = model.getTightBounds()

which fills a with (minx, miny, minz) and b with (maxx, maxy, maxz).

Note that 3-D coordinates have no relationship to pixels, so your original question was a bit confusing.


I guess I was trying to say steps, which is the reason I used pixels, as in - 30 pixels from the left of an object and 30 pixels to the right of an object.

It’s because know a 3D scene is still just a flat 2D image (picture)


Thanks for that info. I made a note of the method you posted. I went in another direction code wise so I won’t need to use it just yet.

I just finished writing code that makes an actor move to a point and go around anything that’s in its way.

I wantd to use P3D’s pathfinding, but the python version of the navmesh generator is broken.