putting a 2D box around an object?

Blitz3D Forums/Blitz3D Programming/putting a 2D box around an object?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

EntityRadius does not return a radius, it's used to set the Collision Radius if spherical Collision is used.

This is really not so easy since ProjectCamera will return the Meshes center onscreen, but a the mesh usually don't knows how big it is since ScaleEntity and ScaleMEsh is involved, and EntityWidht / Height / Depth depends on the View Angle

What I would do is: After loading the mesh I would parse all Vertices of the mesh and store Min xyz and max xyz, These can be used to create 8 Pivots that are representing a Box that completely and exactly covers the mesh. Then I'd parent the pivots to the mesh, so any further scaling will affect the pivot loactions too.

Now to draw the rectangle simply use ProjectCamera with all 8 Pivots and find the onscreen Min xy and max xy pivots. Now you've got the 4 2D Points to draw the rectangle.

Probably there is an easier solution, I don't know right now.
EDIT - I must agree, the sprite solution is clever, although the angle of view may produce inaccuracies.