Get prop width

Hello FP,
I wanted to ask if its possible to get the “prop width” to make 3d2d alignment/sizing better, like to fill out the whole PC screen from the CSS props.

[editline]18th August 2015[/editline]

Also, I wanted to ask why 3D2D text cant be black, it gets invisible the “darker” it is?

These may be useful.

Entity:GetModelBounds

or

Entity:GetCollisionBounds

Find if x y or z from the bounding box is your width and then multiply by 2 to fill the entire thing.

As for black 3d2d text, I’m not sure, never tried it before.

GetModelBounds is the same as the one below, except the Phsyobj isn’t stated, as it says, and the object these functions use is the OBB, which is on most props(eg screens) a box around it, not the prop itself :confused:

Well unless the model creator is really lazy with modelling, most of the time the bounding box is pretty tightly wrapped around the actual prop, so all you’d need to do is get the width and subtract a few units until perfect.

the fine tuning would be pretty much the same as making it without auto width stuff, like the RT screen is around 600px wide.

Well I’m sorry, I don’t know any other ways to accomplish it. :frown:

Meh, it would be nice to know since it’d make aligning for me much easier, but I guess I have to do it the old way with using floats.

The problem is, its giving vectors, and I am somehow to dumb to use the toscreen shit

When doing 3D2D, your scale determines your pixel:unit ratio.

So, let’s say we have a screen that looks like this:

╔═══════════╗
║███████████║
║███████████║
║███████████║
╚═══════════╝

We know two points on the model - the upper left, and the lower right. From these two points we can derive the upper right ( lr.x, lr.y, ul.z ) and the lower left ( ul.x, ul.y, lr.z ). From this, we can then “measure” the dimensions of the screen similar to this:


function GetScreenBounds( a, b, scale )
	c = Vector( b.x, b.y, a.z )
	d = Vector( a.x, a.y, b.z )

	return a:Distance( c ) / scale, a:Distance( d ) / scale
end

We know the distance between the upper left and the lower left ( the height ) as well as the distance between the upper left and the upper right ( the width ). Since a larger scale indicates less pixels and a scale of 1 indicates each unit is a pixel, we need to divide by the scale - so .5 would give us a display twice the size as normal, and a scale of 2 would give us half the size as normal.

As for text color - your font probably has additive set to true - change it to false. It’s a really crappy image, but it should show what it sounds like is happening:

Black text would add nothing to the color behind it, making it appear transparent.