Garry's Mod Wiki

Color:ToVector

Color:ToVector

  Vector Color:ToVector()

Description

Translates the Color into a Vector, losing the alpha channel. This will also range the values from 0 - 255 to 0 - 1

r / 255 -> x
g / 255 -> y
b / 255 -> z

This is the opposite of Vector:ToColor

Returns

1 Vector
The created Vector

Example

Useful when setting player colors, since the function requires a vector as argument.

Entity( 1 ):SetPlayerColor( Color( 220, 20, 60 ):ToVector() )
Output: Sets the player color for Player1 (only works if they are using a colorable player model)

Special Pages


Wikis

?

Render Time: 85ms

DB GetPage 48
Generate Html 4
SaveChanges (1) 23
Render Body 0
Render Sidebar 7