Entity.OBBCenter

From GMod Wiki

Revision as of 06:12, 25 January 2011 by Immibis (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
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: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Entity.OBBCenter]Entity.OBBCenter [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionThe following code can be used to get the center of an entity.
Used onNewerShared.png
Code
ent = ents.GetAll()[1]
print(ent:LocalToWorld(ent:OBBCenter()))
OutputThe center of the first entity.


Additional Notes

Orientated Bounding Box with local coordinate setup.

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox