s&
newspaper
About
info
About s&box
newspaper
Latest News
published_with_changes
Changes
map
Roadmap
monitoring
Metrics
games
Games
sports_esports
Browse Games
rocket
Discover Games
business_center
Workshop
sports_esports
Games
landscape
Maps
chair
Models
texture
Materials
apparel
Clothing
construction
More..
forum
Forum
docs
Docs
docs
Documentation
dashboard
Api Reference
school
Tutorials
input
Log in with Steam
chevron_left
Change Language
简体中文
English
Русский
Español
Português-Brasil
Deutsch
日本語
Français
Polski
Türkçe
한국어
Pirate
Italiano
ไทย
繁體中文
Українська
Čeština
Nederlands
Magyar
Dansk
Suomi
Svenska
Norsk
Ελληνικά
Română
Български
Tiếng Việt
Bahasa Indonesia
Español-Latinoamérica
العربية
Api
Common Structs
Vector4
chevron_left
Common Structs
struct
Vector4
search
Constructors
functions
Vector4
Properties
data_object
IsInfinity
data_object
IsNaN
data_object
IsNearZeroLength
data_object
Item
data_object
Length
data_object
LengthSquared
data_object
w
data_object
x
data_object
y
data_object
z
Methods
functions
AlmostEqual
functions
Clamp
functions
ComponentMax
functions
ComponentMin
functions
Distance
functions
DistanceSquared
functions
IsNearlyZero
functions
LerpTo
functions
Min
functions
SnapToGrid
functions
WithW
functions
WithX
functions
WithY
functions
WithZ
Static Fields
crop_din
One
crop_din
Zero
Static Methods
functions
DistanceBetween
functions
DistanceBetweenSquared
functions
Dot
functions
Lerp
functions
Max
functions
Parse
functions
Sort
functions
TryParse
Vector4
A 4-dimensional vector/point.
struct
sealed
Sandbox.System
build
Constructors
1
Vector4
(
x
,
y
,
z
,
w
)
Initializes a vector4 with given components.
data_object
Properties
10
IsInfinity
bool
Returns true if x, y, z or w are infinity
IsNaN
bool
Returns true if x, y, z or w are NaN
IsNearZeroLength
bool
Whether length of this vector is nearly zero.
Item
float
Length
float
The length (or magnitude) of the vector (Distance from 0,0,0).
LengthSquared
float
Squared length of the vector. This is faster than Vector4.Length, and can be used for things like comparing distances, as long as only squared values are used.
w
float
The W component of this Vector.
x
float
The X component of this Vector.
y
float
The Y component of this Vector.
z
float
The Z component of this Vector.
functions
Methods
14
AlmostEqual
(
v
,
delta
)
bool
Returns true if we're nearly equal to the passed vector.
Clamp
(
otherMin
,
otherMax
)
Vector4
Returns a vector each axis of which is clamped to between the 2 given vectors.
ComponentMax
(
other
)
Vector4
Returns a vector that has the maximum values on each axis between this vector and given vector.
ComponentMin
(
other
)
Vector4
Returns a vector that has the minimum values on each axis between this vector and given vector.
Distance
(
target
)
float
Returns distance between this vector to given vector.
DistanceSquared
(
target
)
float
Returns squared distance between this vector to given vector. This is faster than
Distance
, and can be used for things like comparing distances, as long as only squared values are used.
IsNearlyZero
(
tolerance
)
bool
Returns true if value on every axis is less than tolerance away from zero
LerpTo
(
target
,
frac
,
clamp
)
Vector4
Performs linear interpolation between this and given vectors.
Min
(
a
,
b
)
Vector4
Returns a vector that has the minimum values on each axis between the 2 given vectors.
SnapToGrid
(
gridSize
,
sx
,
sy
,
sz
,
sw
)
Vector4
Snap to grid along any of the 4 axes.
WithW
(
w
)
Vector4
Returns this vector with given W component.
WithX
(
x
)
Vector4
Returns this vector with given X component.
WithY
(
y
)
Vector4
Returns this vector with given Y component.
WithZ
(
z
)
Vector4
Returns this vector with given Z component.
crop_din
Static Fields
2
One
Vector4
A 4D vector with all components set to 1.
Zero
Vector4
A 4D vector with all components set to 0.
functions
Static Methods
8
DistanceBetween
(
a
,
b
)
float
DistanceBetweenSquared
(
a
,
b
)
float
Returns squared distance between the 2 given vectors. This is faster than
DistanceBetween
, and can be used for things like comparing distances, as long as only squared values are used.
Dot
(
a
,
b
)
float
Returns the scalar/dot product of the 2 given vectors
Lerp
(
a
,
b
,
frac
,
clamp
)
Vector4
Performs linear interpolation between 2 given vectors.
Max
(
a
,
b
)
Vector4
Returns a vector that has the maximum values on each axis between the 2 given vectors.
Parse
(
str
)
Vector4
Given a string, try to convert this into a vector4. The format is "x,y,z,w".
Sort
(
min
,
max
)
Sort these two vectors into min and max. This doesn't just swap the vectors, it sorts each component. So that min will come out containing the minimum x, y, z and w values.
TryParse
(
str
,
result
)
bool
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.