Vector.Rotate

From GMod Wiki

Jump to: navigation, search
Function
Syntax Vector:Rotate( Angle )
Description:
Will rotate the vector around the origin by an angle.
Returns: nil
In Object: Vector
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Vector.Rotate]Vector.Rotate [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionRotates myvector around the origin by myangle
Used onNewerShared.png
Code
local myvector = Vector(-21, -21, -38);
local myangle = Angle(90, 90, 90);
myvector:Rotate( myangle );
Output-38, -21, 21


DescriptionEquation for Angle.Forward
Used onNewerShared.png
Code
 
    MyAng = Angle(10,30,50)
 
    myVector = Vector(1,0,0)
    myVector:Rotate(MyAng)
 
    print("Angle Forward: " .. tostring(MyAng:Forward()))
    print("Another way: " .. tostring(myVector))
 
OutputAngle Forward: 0.8529 0.4924 -0.1736
Another way: 0.8529 0.4924 -0.1736


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox