Vector.Angle
From GMod Wiki
| Function | |
| Syntax | Vector:Angle( ) |
| Description: | |
| Converts a vector into an Angle . | |
| Returns: | Angle |
| In Object: | Vector |
| Realm: |
|
| BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Vector.Angle]Vector.Angle [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
| Description | Set an entity's angles |
|---|---|
| Used on | |
| Code | ent:SetAngles(ply:GetForward():Normalize():Angle()) |
| Output | Ent faces same way as ply |
Additional Notes
- This is the opposite of Angle:Forward().
- The vector doesn't need to be normalized.
- The roll of the returned angle will always be zero when using this function. This is because the roll describes the rotation around the axis - the vector is just an axis.