Entity.OBBCenter
From GMod Wiki
Function | |
Syntax | Entity:OBBCenter( ) |
Description: | |
Returns the center of an entity's OBB as a local vector. Note that this isn't always the same as getting the position of the entity. The center of the bounding box in world coordinates is usually a better source for the center of the model than the position of the model is. | |
Returns: | Vector |
In Object: | Entity |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Entity.OBBCenter]Entity.OBBCenter [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | The following code can be used to get the center of an entity. |
---|---|
Used on | |
Code | ent = ents.GetAll()[1] print(ent:LocalToWorld(ent:OBBCenter())) |
Output | The center of the first entity. |
Additional Notes
- See the picture to the right for more help understanding the OBB. Keep in mind the coordinates are local - which means the OBB can be rotated or moved around in the world, but the local coordinates will not change.