Dependencies
.Net SDK 9.0 is required for development.
Currently, it's also required on player machine. That's temporary limitation, self-contained distribution will be supported soon.
Download
- Windows
- macOS
- Binaries are not signed, so it requires to allow it running on your Mac in macOS settings.
- Linux
- Install from sources
How to use
Install .NET 9.0 SDK if it's not installed yet.
Select a project directory where you'll keep scripts and other resources.
Run editor:
- (All OS) Specify project directory via command line argument
C:/dev/fyrox_cs_sdk/fyroxed_cs_netcore.exe <path>
- (Windows only) Double-click on
C:/dev/fyrox_cs_sdk/fyroxed_cs_netcore.exe
icon and choose project directory in opened dialog window. - (Windows only) Drop project directory on the
C:/dev/fyrox_cs_sdk/fyroxed_cs_netcore.exe
icon in file explorer.
Minimal C# project files will be created automatically and C# project will be automatically compiled.
Game can be launched using Play button in editor. Also, game can be launched using IDE with debug support (run profile
for JB Rider generated, for other IDE note that working directory should be the project directory, not the build
directory). Also, game can be launched using dotnet run
in the game directory.
Scripts
Inherit classes from NodeScript
to create scripts that can be attached to scene nodes in editor via dropdown on
Inspector panel at the right.
Inherit from GlobalScript
to create singleton scripts (no need for [Uuid(...)]
attribute).
NodeScript classes should be annotatee using [Uuid(...)]
attribute.
Consider JB Rider plugin for Fyrox C# - it
generates UUID, but also puts attribute if script created via context menu, also it highlight fields. If you use
different
IDE,
UUID
value using any online service like this.
Look into guards_cs project as an example.
Scripts Reloading
Editor reloads scripts metadata automatically after their compilation. In-game hot reload is not supported.
Scenes & Assets
Original Fyrox engine is 100% relevant in all non-code things, so Fyrox Book is advised for non-code information.
CLI
The fyroxed_cs_netcore.exe
can also be invoked via terminal with project path argument.
Install from sources
That's optional, because prebuilt binaries are available.
- Install .NET 9.0 SDK if it's not installed yet.
- Install latest Rust toolchain.
- (Windows only) Install Git Bash. Other MSYS2 distribution haven't tested.
- Checkout sources and install using shell command (use Git Bash on windows)
git clone https://github.com/kkolyan/fyrox_lite.git \ && cd fyrox_lite \ && chmod +x **/*.sh \ && ./bash/cs_install_sdk.sh <installation path>
<installation path>
now contains ready-to-use binaries.
Scripting API (C#)
Color
package
Description
Classes
Color
struct in Color
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
A color represented by red, green, blue, and alpha (RGBA) components.
The alpha component is often used for transparency.
Values are in floating-point and usually range from 0 to 1.
Some properties (such as
CanvasItem.Modulate
) may accept values
greater than 1 (overbright or HDR colors).
If you want to supply values in a range of 0 to 255, you should use
Color8
and the
r8
/
g8
/
b8
/
a8
properties.
Constructors
Signature | Description |
---|---|
( float r, float g, float b, float a ) | Constructs a Color from RGBA values, typically on the range of 0 to 1. |
( Color c, float a ) | Constructs a Color from an existing color and an alpha value. |
( uint rgba ) | Constructs a Color from an unsigned 32-bit integer in RGBA format (each byte represents a color channel). |
( ulong rgba ) | Constructs a Color from an unsigned 64-bit integer in RGBA format (each word represents a color channel). |
( string code ) | Constructs a Color either from an HTML color code or from a standardized color name. Supported color names are the same as the Colors constants. |
( string code, float alpha ) | Constructs a Color either from an HTML color code or from a standardized color name, with name on the range of 0 to 1. Supported color names are the same as the Colors constants. |
Properties
Name | Type | Access | Description |
---|---|---|---|
R8 | byte | get / set | Wrapper for R that uses the range 0 to 255 instead of 0 to 1. Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255. |
G8 | byte | get / set | Wrapper for G that uses the range 0 to 255 instead of 0 to 1. Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255. |
B8 | byte | get / set | Wrapper for B that uses the range 0 to 255 instead of 0 to 1. Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255. |
A8 | byte | get / set | Wrapper for A that uses the range 0 to 255 instead of 0 to 1. Getting is equivalent to multiplying by 255 and rounding. Setting is equivalent to dividing by 255. |
H | float | get / set | The HSV hue of this color, on the range 0 to 1. Getting is a long process, refer to the source code for details. Setting uses FromHsv . |
S | float | get / set | The HSV saturation of this color, on the range 0 to 1. Getting is equivalent to the ratio between the min and max RGB value. Setting uses FromHsv . |
V | float | get / set | The HSV value (brightness) of this color, on the range 0 to 1. Getting is equivalent to using Math.Max(float, float) on the RGB components. Setting uses FromHsv . |
Luminance | float | get | Returns the light intensity of the color, as a value between 0.0 and 1.0 (inclusive). This is useful when determining light or dark color. Colors with a luminance smaller than 0.5 can be generally considered dark. Note: Luminance relies on the color being in the linear color space to return an accurate relative luminance value. If the color is in the sRGB color space use SrgbToLinear to convert it to the linear color space first. |
Methods
Return Type | Signature | Description |
---|---|---|
Color | Blend ( Color over ) | Returns a new color resulting from blending this color over another. If the color is opaque, the result is also opaque. The second color may have a range of alpha values. |
Color | Clamp ( Color? min, Color? max ) | Returns a new color with all components clamped between the components of name and name using Mathf.Clamp(float, float, float) . |
Color | Darkened ( float amount ) | Returns a new color resulting from making this color darker by the specified ratio (on the range of 0 to 1). |
Color | Inverted ( ) | Returns the inverted color: (1 - r, 1 - g, 1 - b, a) . |
Color | Lightened ( float amount ) | Returns a new color resulting from making this color lighter by the specified ratio (on the range of 0 to 1). |
Color | Lerp ( Color to, float weight ) | Returns the result of the linear interpolation between this color and name by amount name . |
Color | LinearToSrgb ( ) | Returns the color converted to the sRGB color space. This method assumes the original color is in the linear color space. See also SrgbToLinear which performs the opposite operation. |
Color | SrgbToLinear ( ) | Returns the color converted to linear color space. This method assumes the original color already is in sRGB color space. See also LinearToSrgb which performs the opposite operation. |
uint | ToAbgr32 ( ) | Returns the color converted to an unsigned 32-bit integer in ABGR format (each byte represents a color channel). ABGR is the reversed version of the default format. |
ulong | ToAbgr64 ( ) | Returns the color converted to an unsigned 64-bit integer in ABGR format (each word represents a color channel). ABGR is the reversed version of the default format. |
uint | ToArgb32 ( ) | Returns the color converted to an unsigned 32-bit integer in ARGB format (each byte represents a color channel). ARGB is more compatible with DirectX, but not used much in Godot. |
ulong | ToArgb64 ( ) | Returns the color converted to an unsigned 64-bit integer in ARGB format (each word represents a color channel). ARGB is more compatible with DirectX, but not used much in Godot. |
uint | ToRgba32 ( ) | Returns the color converted to an unsigned 32-bit integer in RGBA format (each byte represents a color channel). RGBA is Godot's default and recommended format. |
ulong | ToRgba64 ( ) | Returns the color converted to an unsigned 64-bit integer in RGBA format (each word represents a color channel). RGBA is Godot's default and recommended format. |
string | ToHtml ( bool includeAlpha ) | Returns the color's HTML hexadecimal color string in RGBA format. |
void | ToHsv ( float hue, float saturation, float value ) | Converts a color to HSV values. This is equivalent to using each of the h / s / v properties, but much more efficient. |
bool | Equals ( object? obj ) | Returns true if this color and name are equal. |
bool | Equals ( Color other ) | Returns true if the colors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | IsEqualApprox ( Color other ) | Returns true if this color and name are approximately equal, by running Mathf.IsEqualApprox(float, float) on each component. |
int | GetHashCode ( ) | Serves as the hash function for Color . |
string | ToString ( ) | Converts this Color to a string. |
string | ToString ( string? format ) | Converts this Color to a string with the given name . |
Static Methods
Return Type | Signature | Description |
---|---|---|
Color | FromHtml ( ReadOnlySpan rgba ) | Constructs a Color from the HTML hexadecimal color string in RGBA format. |
Color | Color8 ( byte r8, byte g8, byte b8, byte a8 ) | Returns a color constructed from integer red, green, blue, and alpha channels. Each channel should have 8 bits of information ranging from 0 to 255. |
Color | FromHsv ( float hue, float saturation, float value, float alpha ) | Constructs a color from an HSV profile. The name , name , and name are typically between 0.0 and 1.0. |
Color | FromRgbe9995 ( uint rgbe ) | Encodes a Color from a RGBE9995 format integer. See Image.Format.Rgbe9995 . |
Color | FromString ( string str, Color @default ) | Constructs a color from the given string, which can be either an HTML color code or a named color. Returns name if the color cannot be inferred from the string. Supported color names are the same as the Colors constants. |
bool | HtmlIsValid ( ReadOnlySpan color ) | Returns true if name is a valid HTML hexadecimal color string. The string must be a hexadecimal value (case-insensitive) of either 3, 4, 6 or 8 digits, and may be prefixed by a hash sign ( # ). This method is identical to StringExtensions.IsValidHtmlColor(string) . |
Operators
Return Type | Signature | Description |
---|---|---|
Color | + ( Color left, Color right ) | Adds each component of the Color with the components of the given Color . |
Color | - ( Color left, Color right ) | Subtracts each component of the Color by the components of the given Color . |
Color | - ( Color color ) | Inverts the given color. This is equivalent to Colors.White - c or new Color(1 - c.R, 1 - c.G, 1 - c.B, 1 - c.A) . |
Color | * ( Color color, float scale ) | Multiplies each component of the Color by the given float . |
Color | * ( float scale, Color color ) | Multiplies each component of the Color by the given float . |
Color | * ( Color left, Color right ) | Multiplies each component of the Color by the components of the given Color . |
Color | / ( Color color, float scale ) | Divides each component of the Color by the given float . |
Color | / ( Color left, Color right ) | Divides each component of the Color by the components of the given Color . |
bool | == ( Color left, Color right ) | Returns true if the colors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | != ( Color left, Color right ) | Returns true if the colors are not equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | < ( Color left, Color right ) | Compares two Color s by first checking if the red value of the name color is less than the red value of the name color. If the red values are exactly equal, then it repeats this check with the green values of the two colors, then with the blue values, and then with the alpha value. This operator is useful for sorting colors. |
bool | > ( Color left, Color right ) | Compares two Color s by first checking if the red value of the name color is greater than the red value of the name color. If the red values are exactly equal, then it repeats this check with the green values of the two colors, then with the blue values, and then with the alpha value. This operator is useful for sorting colors. |
bool | <= ( Color left, Color right ) | Compares two Color s by first checking if the red value of the name color is less than or equal to the red value of the name color. If the red values are exactly equal, then it repeats this check with the green values of the two colors, then with the blue values, and then with the alpha value. This operator is useful for sorting colors. |
bool | >= ( Color left, Color right ) | Compares two Color s by first checking if the red value of the name color is greater than or equal to the red value of the name color. If the red values are exactly equal, then it repeats this check with the green values of the two colors, then with the blue values, and then with the alpha value. This operator is useful for sorting colors. |
Colors
class in Color
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
This class contains color constants created from standardized color names. The standardized color set is based on the X11 and .NET color names.
Constants
Name | Type | Description | Initializer |
---|---|---|---|
AliceBlue | Color | #F0F8FF | |
AntiqueWhite | Color | #FAEBD7 | |
Aqua | Color | #00FFFF | |
Aquamarine | Color | #7FFFD4 | |
Azure | Color | #F0FFFF | |
Beige | Color | #F5F5DC | |
Bisque | Color | #FFE4C4 | |
Black | Color | #000000 | |
BlanchedAlmond | Color | #FFEBCD | |
Blue | Color | #0000FF | |
BlueViolet | Color | #8A2BE2 | |
Brown | Color | #A52A2A | |
Burlywood | Color | #DEB887 | |
CadetBlue | Color | #5F9EA0 | |
Chartreuse | Color | #7FFF00 | |
Chocolate | Color | #D2691E | |
Coral | Color | #FF7F50 | |
CornflowerBlue | Color | #6495ED | |
Cornsilk | Color | #FFF8DC | |
Crimson | Color | #DC143C | |
Cyan | Color | #00FFFF | |
DarkBlue | Color | #00008B | |
DarkCyan | Color | #008B8B | |
DarkGoldenrod | Color | #B8860B | |
DarkGray | Color | #A9A9A9 | |
DarkGreen | Color | #006400 | |
DarkKhaki | Color | #BDB76B | |
DarkMagenta | Color | #8B008B | |
DarkOliveGreen | Color | #556B2F | |
DarkOrange | Color | #FF8C00 | |
DarkOrchid | Color | #9932CC | |
DarkRed | Color | #8B0000 | |
DarkSalmon | Color | #E9967A | |
DarkSeaGreen | Color | #8FBC8F | |
DarkSlateBlue | Color | #483D8B | |
DarkSlateGray | Color | #2F4F4F | |
DarkTurquoise | Color | #00CED1 | |
DarkViolet | Color | #9400D3 | |
DeepPink | Color | #FF1493 | |
DeepSkyBlue | Color | #00BFFF | |
DimGray | Color | #696969 | |
DodgerBlue | Color | #1E90FF | |
Firebrick | Color | #B22222 | |
FloralWhite | Color | #FFFAF0 | |
ForestGreen | Color | #228B22 | |
Fuchsia | Color | #FF00FF | |
Gainsboro | Color | #DCDCDC | |
GhostWhite | Color | #F8F8FF | |
Gold | Color | #FFD700 | |
Goldenrod | Color | #DAA520 | |
Gray | Color | #BEBEBE | |
Green | Color | #00FF00 | |
GreenYellow | Color | #ADFF2F | |
Honeydew | Color | #F0FFF0 | |
HotPink | Color | #FF69B4 | |
IndianRed | Color | #CD5C5C | |
Indigo | Color | #4B0082 | |
Ivory | Color | #FFFFF0 | |
Khaki | Color | #F0E68C | |
Lavender | Color | #E6E6FA | |
LavenderBlush | Color | #FFF0F5 | |
LawnGreen | Color | #7CFC00 | |
LemonChiffon | Color | #FFFACD | |
LightBlue | Color | #ADD8E6 | |
LightCoral | Color | #F08080 | |
LightCyan | Color | #E0FFFF | |
LightGoldenrod | Color | #FAFAD2 | |
LightGray | Color | #D3D3D3 | |
LightGreen | Color | #90EE90 | |
LightPink | Color | #FFB6C1 | |
LightSalmon | Color | #FFA07A | |
LightSeaGreen | Color | #20B2AA | |
LightSkyBlue | Color | #87CEFA | |
LightSlateGray | Color | #778899 | |
LightSteelBlue | Color | #B0C4DE | |
LightYellow | Color | #FFFFE0 | |
Lime | Color | #00FF00 | |
LimeGreen | Color | #32CD32 | |
Linen | Color | #FAF0E6 | |
Magenta | Color | #FF00FF | |
Maroon | Color | #B03060 | |
MediumAquamarine | Color | #66CDAA | |
MediumBlue | Color | #0000CD | |
MediumOrchid | Color | #BA55D3 | |
MediumPurple | Color | #9370DB | |
MediumSeaGreen | Color | #3CB371 | |
MediumSlateBlue | Color | #7B68EE | |
MediumSpringGreen | Color | #00FA9A | |
MediumTurquoise | Color | #48D1CC | |
MediumVioletRed | Color | #C71585 | |
MidnightBlue | Color | #191970 | |
MintCream | Color | #F5FFFA | |
MistyRose | Color | #FFE4E1 | |
Moccasin | Color | #FFE4B5 | |
NavajoWhite | Color | #FFDEAD | |
NavyBlue | Color | #000080 | |
OldLace | Color | #FDF5E6 | |
Olive | Color | #808000 | |
OliveDrab | Color | #6B8E23 | |
Orange | Color | #FFA500 | |
OrangeRed | Color | #FF4500 | |
Orchid | Color | #DA70D6 | |
PaleGoldenrod | Color | #EEE8AA | |
PaleGreen | Color | #98FB98 | |
PaleTurquoise | Color | #AFEEEE | |
PaleVioletRed | Color | #DB7093 | |
PapayaWhip | Color | #FFEFD5 | |
PeachPuff | Color | #FFDAB9 | |
Peru | Color | #CD853F | |
Pink | Color | #FFC0CB | |
Plum | Color | #DDA0DD | |
PowderBlue | Color | #B0E0E6 | |
Purple | Color | #A020F0 | |
RebeccaPurple | Color | #663399 | |
Red | Color | #FF0000 | |
RosyBrown | Color | #BC8F8F | |
RoyalBlue | Color | #4169E1 | |
SaddleBrown | Color | #8B4513 | |
Salmon | Color | #FA8072 | |
SandyBrown | Color | #F4A460 | |
SeaGreen | Color | #2E8B57 | |
Seashell | Color | #FFF5EE | |
Sienna | Color | #A0522D | |
Silver | Color | #C0C0C0 | |
SkyBlue | Color | #87CEEB | |
SlateBlue | Color | #6A5ACD | |
SlateGray | Color | #708090 | |
Snow | Color | #FFFAFA | |
SpringGreen | Color | #00FF7F | |
SteelBlue | Color | #4682B4 | |
Tan | Color | #D2B48C | |
Teal | Color | #008080 | |
Thistle | Color | #D8BFD8 | |
Tomato | Color | #FF6347 | |
Transparent | Color | #FFFFFF | |
Turquoise | Color | #40E0D0 | |
Violet | Color | #EE82EE | |
WebGray | Color | #808080 | |
WebGreen | Color | #008000 | |
WebMaroon | Color | #800000 | |
WebPurple | Color | #800080 | |
Wheat | Color | #F5DEB3 | |
White | Color | #FFFFFF | |
WhiteSmoke | Color | #F5F5F5 | |
Yellow | Color | #FFFF00 | |
YellowGreen | Color | #9ACD32 |
Input
package
Description
User input utilities
Classes
Input
class in Input
Description
Utility class to poll player input events
Constants
Name | Type | Value | Description |
---|---|---|---|
MouseLeft | int | 0 | Left Mouse Button ID |
MouseRight | int | 1 | |
MouseMiddle | int | 2 | |
MouseBack | int | 3 | |
MouseForward | int | 4 |
Static Properties
Static Methods
Return Type | Signature | Description |
---|---|---|
bool | IsMouseButtonDown ( int button ) | is mouse button with ID |
bool | IsMouseButtonUp ( int button ) | |
bool | IsMouseButtonPressed ( int button ) | |
bool | IsKeyDown ( KeyCode key ) | |
bool | IsKeyUp ( KeyCode key ) | |
bool | IsKeyPressed ( KeyCode key ) |
KeyCode
enum in Input
Description
Basically a copy of winit
’s KeyCode
, which is mostly inspired by UI Events Specification’s KeyboardEvent.code
.
Properties
Property | Description |
---|---|
Backquote | ` on a US keyboard. This is also called a backtick or grave. This is the 半角/全角/漢字 (hankaku/zenkaku/kanji) key on Japanese keyboards |
Backslash | Used for both the US \ (on the 101-key layout) and also for the key located between the “ and Enter keys on row C of the 102-, 104- and 106-key layouts. Labeled # on a UK (102) keyboard. |
BracketLeft | [ on a US keyboard. |
BracketRight | ] on a US keyboard. |
Comma | , on a US keyboard. |
Digit0 | 0 on a US keyboard. |
Digit1 | 1 on a US keyboard. |
Digit2 | 2 on a US keyboard. |
Digit3 | 3 on a US keyboard. |
Digit4 | 4 on a US keyboard. |
Digit5 | 5 on a US keyboard. |
Digit6 | 6 on a US keyboard. |
Digit7 | 7 on a US keyboard. |
Digit8 | 8 on a US keyboard. |
Digit9 | 9 on a US keyboard. |
Equal | = on a US keyboard. |
IntlBackslash | Located between the left Shift and Z keys. Labeled \ on a UK keyboard. |
IntlRo | Located between the / and right Shift keys. Labeled \ (ro) on a Japanese keyboard. |
IntlYen | Located between the = and Backspace keys. Labeled ¥ (yen) on a Japanese keyboard. \ on a Russian keyboard. |
A | a on a US keyboard. Labeled q on an AZERTY (e.g., French) keyboard. |
B | b on a US keyboard. |
C | c on a US keyboard. |
D | d on a US keyboard. |
E | e on a US keyboard. |
F | f on a US keyboard. |
G | g on a US keyboard. |
H | h on a US keyboard. |
I | i on a US keyboard. |
J | j on a US keyboard. |
K | k on a US keyboard. |
L | l on a US keyboard. |
M | m on a US keyboard. |
N | n on a US keyboard. |
O | o on a US keyboard. |
P | p on a US keyboard. |
Q | q on a US keyboard. Labeled a on an AZERTY (e.g., French) keyboard. |
R | r on a US keyboard. |
S | s on a US keyboard. |
T | t on a US keyboard. |
U | u on a US keyboard. |
V | v on a US keyboard. |
W | w on a US keyboard. Labeled z on an AZERTY (e.g., French) keyboard. |
X | x on a US keyboard. |
Y | y on a US keyboard. Labeled z on a QWERTZ (e.g., German) keyboard. |
Z | z on a US keyboard. Labeled w on an AZERTY (e.g., French) keyboard, and y on a QWERTZ (e.g., German) keyboard. |
Minus | - on a US keyboard. |
Period | . on a US keyboard. |
Quote | ’ on a US keyboard. |
Semicolon | ; on a US keyboard. |
Slash | / on a US keyboard. |
AltLeft | Alt, Option, or ⌥. |
AltRight | Alt, Option, or ⌥. This is labeled AltGr on many keyboard layouts. |
Backspace | Backspace or ⌫. Labeled Delete on Apple keyboards. |
CapsLock | CapsLock or ⇪ |
ContextMenu | The application context menu key, which is typically found between the right Super key and the right Control key. |
ControlLeft | Control or ⌃ |
ControlRight | Control or ⌃ |
Enter | Enter or ↵. Labeled Return on Apple keyboards. |
SuperLeft | The Windows, ⌘, Command, or other OS symbol key. |
SuperRight | The Windows, ⌘, Command, or other OS symbol key. |
ShiftLeft | Shift or ⇧ |
ShiftRight | Shift or ⇧ |
Space | (space) |
Tab | Tab or ⇥ |
Convert | Japanese: 変 (henkan) |
KanaMode | Japanese: カタカナ/ひらがな/ローマ字 (katakana/hiragana/romaji) |
Lang1 | Korean: HangulMode 한/영 (han/yeong) Japanese (Mac keyboard): か (kana) |
Lang2 | Korean: Hanja 한 (hanja) Japanese (Mac keyboard): 英 (eisu) |
Lang3 | Japanese (word-processing keyboard): Katakana |
Lang4 | Japanese (word-processing keyboard): Hiragana |
Lang5 | Japanese (word-processing keyboard): Zenkaku/Hankaku |
NonConvert | Japanese: 無変換 (muhenkan) |
Delete | ⌦. The forward delete key. Note that on Apple keyboards, the key labelled Delete on the main part of the keyboard is encoded as |
End | Page Down, End, or ↘ |
Help | Help. Not present on standard PC keyboards. |
Home | Home or ↖ |
Insert | Insert or Ins. Not present on Apple keyboards. |
PageDown | Page Down, PgDn, or ⇟ |
PageUp | Page Up, PgUp, or ⇞ |
ArrowDown | ↓ |
ArrowLeft | ← |
ArrowRight | → |
ArrowUp | ↑ |
NumLock | On the Mac, this is used for the numpad Clear key. |
Numpad0 | 0 Ins on a keyboard. 0 on a phone or remote control |
Numpad1 | 1 End on a keyboard. 1 or 1 QZ on a phone or remote control |
Numpad2 | 2 ↓ on a keyboard. 2 ABC on a phone or remote control |
Numpad3 | 3 PgDn on a keyboard. 3 DEF on a phone or remote control |
Numpad4 | 4 ← on a keyboard. 4 GHI on a phone or remote control |
Numpad5 | 5 on a keyboard. 5 JKL on a phone or remote control |
Numpad6 | 6 → on a keyboard. 6 MNO on a phone or remote control |
Numpad7 | 7 Home on a keyboard. 7 PQRS or 7 PRS on a phone or remote control |
Numpad8 | 8 ↑ on a keyboard. 8 TUV on a phone or remote control |
Numpad9 | 9 PgUp on a keyboard. 9 WXYZ or 9 WXY on a phone or remote control |
NumpadAdd | + |
NumpadBackspace | Found on the Microsoft Natural Keyboard. |
NumpadClear | C or A (All Clear). Also for use with numpads that have a Clear key that is separate from the NumLock key. On the Mac, the numpad Clear key is encoded as |
NumpadClearEntry | C (Clear Entry) |
NumpadComma | , (thousands separator). For locales where the thousands separator is a “.” (e.g., Brazil), this key may generate a .. |
NumpadDecimal | . Del. For locales where the decimal separator is “,” (e.g., Brazil), this key may generate a ,. |
NumpadDivide | / |
NumpadEnter | |
NumpadEqual | = |
NumpadHash | # on a phone or remote control device. This key is typically found below the 9 key and to the right of the 0 key. |
NumpadMemoryAdd | M Add current entry to the value stored in memory. |
NumpadMemoryClear | M Clear the value stored in memory. |
NumpadMemoryRecall | M Replace the current entry with the value stored in memory. |
NumpadMemoryStore | M Replace the value stored in memory with the current entry. |
NumpadMemorySubtract | M Subtract current entry from the value stored in memory. |
NumpadMultiply | on a keyboard. For use with numpads that provide mathematical operations (+, - and /). Use |
NumpadParenLeft | ( Found on the Microsoft Natural Keyboard. |
NumpadParenRight | ) Found on the Microsoft Natural Keyboard. |
NumpadStar | on a phone or remote control device. This key is typically found below the 7 key and to the left of the 0 key. Use “NumpadMultiply” for the key on numeric keypads. |
NumpadSubtract | - |
Escape | Esc or ⎋ |
Fn | Fn This is typically a hardware key that does not generate a separate code. |
FnLock | FLock or FnLock. Function Lock key. Found on the Microsoft Natural Keyboard. |
PrintScreen | PrtScr SysRq or Print Screen |
ScrollLock | Scroll Lock |
Pause | Pause Break |
BrowserBack | Some laptops place this key to the left of the ↑ key. This also the “back” button (triangle) on Android. |
BrowserFavorites | |
BrowserForward | Some laptops place this key to the right of the ↑ key. |
BrowserHome | The “home” button on Android. |
BrowserRefresh | |
BrowserSearch | |
BrowserStop | |
Eject | Eject or ⏏. This key is placed in the function section on some Apple keyboards. |
LaunchApp1 | Sometimes labelled My Computer on the keyboard |
LaunchApp2 | Sometimes labelled Calculator on the keyboard |
LaunchMail | |
MediaPlayPause | |
MediaSelect | |
MediaStop | |
MediaTrackNext | |
MediaTrackPrevious | |
Power | This key is placed in the function section on some Apple keyboards, replacing the Eject key. |
Sleep | |
AudioVolumeDown | |
AudioVolumeMute | |
AudioVolumeUp | |
WakeUp | |
Meta | |
Hyper | |
Turbo | |
Abort | |
Resume | |
Suspend | |
Again | Found on Sun’s USB keyboard. |
Copy | Found on Sun’s USB keyboard. |
Cut | Found on Sun’s USB keyboard. |
Find | Found on Sun’s USB keyboard. |
Open | Found on Sun’s USB keyboard. |
Paste | Found on Sun’s USB keyboard. |
Props | Found on Sun’s USB keyboard. |
Select | Found on Sun’s USB keyboard. |
Undo | Found on Sun’s USB keyboard. |
Hiragana | Use for dedicated ひらがな key found on some Japanese word processing keyboards. |
Katakana | Use for dedicated カタカナ key found on some Japanese word processing keyboards. |
F1 | General-purpose function key. Usually found at the top of the keyboard. |
F2 | General-purpose function key. Usually found at the top of the keyboard. |
F3 | General-purpose function key. Usually found at the top of the keyboard. |
F4 | General-purpose function key. Usually found at the top of the keyboard. |
F5 | General-purpose function key. Usually found at the top of the keyboard. |
F6 | General-purpose function key. Usually found at the top of the keyboard. |
F7 | General-purpose function key. Usually found at the top of the keyboard. |
F8 | General-purpose function key. Usually found at the top of the keyboard. |
F9 | General-purpose function key. Usually found at the top of the keyboard. |
F10 | General-purpose function key. Usually found at the top of the keyboard. |
F11 | General-purpose function key. Usually found at the top of the keyboard. |
F12 | General-purpose function key. Usually found at the top of the keyboard. |
F13 | General-purpose function key. Usually found at the top of the keyboard. |
F14 | General-purpose function key. Usually found at the top of the keyboard. |
F15 | General-purpose function key. Usually found at the top of the keyboard. |
F16 | General-purpose function key. Usually found at the top of the keyboard. |
F17 | General-purpose function key. Usually found at the top of the keyboard. |
F18 | General-purpose function key. Usually found at the top of the keyboard. |
F19 | General-purpose function key. Usually found at the top of the keyboard. |
F20 | General-purpose function key. Usually found at the top of the keyboard. |
F21 | General-purpose function key. Usually found at the top of the keyboard. |
F22 | General-purpose function key. Usually found at the top of the keyboard. |
F23 | General-purpose function key. Usually found at the top of the keyboard. |
F24 | General-purpose function key. Usually found at the top of the keyboard. |
F25 | General-purpose function key. |
F26 | General-purpose function key. |
F27 | General-purpose function key. |
F28 | General-purpose function key. |
F29 | General-purpose function key. |
F30 | General-purpose function key. |
F31 | General-purpose function key. |
F32 | General-purpose function key. |
F33 | General-purpose function key. |
F34 | General-purpose function key. |
F35 | General-purpose function key. |
Log
package
Description
Classes
Log
class in Log
Static Methods
Return Type | Signature | Description |
---|---|---|
void | Info ( string msg ) | |
void | Warn ( string msg ) | |
void | Err ( string msg ) |
Math
package
Description
Classes
Enums
Basis
struct in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
3×3 matrix used for 3D rotation and scale. Almost always used as an orthogonal basis for a Transform.
Contains 3 vector fields X, Y and Z as its columns, which are typically interpreted as the local basis vectors of a 3D transformation. For such use, it is composed of a scaling and a rotation matrix, in that order (M = R.S).
Can also be accessed as array of 3D vectors. These vectors are normally orthogonal to each other, but are not necessarily normalized (due to scaling).
For more information, read this documentation article: https://docs.godotengine.org/en/latest/tutorials/math/matrices_and_transforms.html
Constructors
Signature | Description |
---|---|
( Quaternion quaternion ) | Constructs a pure rotation basis matrix from the given quaternion. |
( Vector3 axis, float angle ) | Constructs a pure rotation basis matrix, rotated around the given name by name (in radians). The axis must be a normalized vector. |
( Vector3 column0, Vector3 column1, Vector3 column2 ) | Constructs a basis matrix from 3 axis vectors (matrix columns). |
( float xx, float yx, float zx, float xy, float yy, float zy, float xz, float yz, float zz ) | Constructs a transformation matrix from the given components. Arguments are named such that xy is equal to calling X.Y . |
Properties
Name | Type | Access | Description |
---|---|---|---|
X | Vector3 | get / set | The basis matrix's X vector (column 0). Equivalent to Column0 and array index [0] . |
Y | Vector3 | get / set | The basis matrix's Y vector (column 1). Equivalent to Column1 and array index [1] . |
Z | Vector3 | get / set | The basis matrix's Z vector (column 2). Equivalent to Column2 and array index [2] . |
Column0 | Vector3 | get / set | Column 0 of the basis matrix (the X vector). Equivalent to X and array index [0] . |
Column1 | Vector3 | get / set | Column 1 of the basis matrix (the Y vector). Equivalent to Y and array index [1] . |
Column2 | Vector3 | get / set | Column 2 of the basis matrix (the Z vector). Equivalent to Z and array index [2] . |
Scale | Vector3 | get | Assuming that the matrix is the combination of a rotation and scaling, return the absolute value of scaling factors along each axis. |
Methods
Return Type | Signature | Description |
---|---|---|
float | Determinant ( ) | Returns the determinant of the basis matrix. If the basis is uniformly scaled, its determinant is the square of the scale. A negative determinant means the basis has a negative scale. A zero determinant means the basis isn't invertible, and is usually considered invalid. |
Vector3 | GetEuler ( EulerOrder order ) | Returns the basis's rotation in the form of Euler angles. The Euler order depends on the name parameter, by default it uses the YXZ convention: when decomposing, first Z, then X, and Y last. The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle). Consider using the GetRotationQuaternion method instead, which returns a Quaternion quaternion instead of Euler angles. |
Quaternion | GetRotationQuaternion ( ) | Returns the Basis 's rotation in the form of a Quaternion . See GetEuler if you need Euler angles, but keep in mind quaternions should generally be preferred to Euler angles. |
Basis | Inverse ( ) | Returns the inverse of the matrix. |
bool | IsFinite ( ) | Returns true if this basis is finite, by calling Mathf.IsFinite(real_t) on each component. |
Basis | Orthonormalized ( ) | Returns the orthonormalized version of the basis matrix (useful to call occasionally to avoid rounding errors for orthogonal matrices). This performs a Gram-Schmidt orthonormalization on the basis of the matrix. |
Basis | Rotated ( Vector3 axis, float angle ) | Introduce an additional rotation around the given name by name (in radians). The axis must be a normalized vector. |
Basis | Scaled ( Vector3 scale ) | Introduce an additional scaling specified by the given 3D scaling factor. |
Basis | Slerp ( Basis target, float weight ) | Assuming that the matrix is a proper rotation matrix, slerp performs a spherical-linear interpolation with another rotation matrix. |
float | Tdotx ( Vector3 with ) | Transposed dot product with the X axis of the matrix. |
float | Tdoty ( Vector3 with ) | Transposed dot product with the Y axis of the matrix. |
float | Tdotz ( Vector3 with ) | Transposed dot product with the Z axis of the matrix. |
Basis | Transposed ( ) | Returns the transposed version of the basis matrix. |
bool | Equals ( object? obj ) | Returns true if the Basis is exactly equal to the given object ( name ). Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | Equals ( Basis other ) | Returns true if the basis matrices are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | IsEqualApprox ( Basis other ) | Returns true if this basis and name are approximately equal, by running Vector3.IsEqualApprox(Vector3) on each component. |
int | GetHashCode ( ) | Serves as the hash function for Basis . |
string | ToString ( ) | Converts this Basis to a string. |
string | ToString ( string? format ) | Converts this Basis to a string with the given name . |
Constants
Name | Type | Description | Initializer |
---|---|---|---|
Identity | Basis | The identity basis, with no rotation or scaling applied. This is used as a replacement for Basis() in GDScript. Do not use new Basis() with no arguments in C#, because it sets all values to zero. Equivalent to new Basis(Vector3.Right, Vector3.Up, Vector3.Back) . | new(1, 0, 0, 0, 1, 0, 0, 0, 1) |
FlipX | Basis | The basis that will flip something along the X axis when used in a transformation. Equivalent to new Basis(Vector3.Left, Vector3.Up, Vector3.Back) . | new(-1, 0, 0, 0, 1, 0, 0, 0, 1) |
FlipY | Basis | The basis that will flip something along the Y axis when used in a transformation. Equivalent to new Basis(Vector3.Right, Vector3.Down, Vector3.Back) . | new(1, 0, 0, 0, -1, 0, 0, 0, 1) |
FlipZ | Basis | The basis that will flip something along the Z axis when used in a transformation. Equivalent to new Basis(Vector3.Right, Vector3.Up, Vector3.Forward) . | new(1, 0, 0, 0, 1, 0, 0, 0, -1) |
Static Methods
Return Type | Signature | Description |
---|---|---|
Basis | LookingAt ( Vector3 target, Vector3? up, bool useModelFront ) | Creates a Basis with a rotation such that the forward axis (-Z) points towards the name position. The up axis (+Y) points as close to the name vector as possible while staying perpendicular to the forward axis. The resulting Basis is orthonormalized. The name and name vectors cannot be zero, and cannot be parallel to each other. |
Basis | LookingAt ( Vector3 target, Vector3 up ) | The same as LookingAt |
Basis | FromEuler ( Vector3 euler, EulerOrder order ) | Constructs a Basis matrix from Euler angles in the specified rotation order. By default, use YXZ order (most common). |
Basis | FromScale ( Vector3 scale ) | Constructs a pure scale basis matrix with no rotation or shearing. The scale values are set as the main diagonal of the matrix, and all of the other parts of the matrix are zero. |
Operators
Return Type | Signature | Description |
---|---|---|
Basis | * ( Basis left, Basis right ) | Composes these two basis matrices by multiplying them together. This has the effect of transforming the second basis (the child) by the first basis (the parent). |
Vector3 | * ( Basis basis, Vector3 vector ) | Returns a Vector3 transformed (multiplied) by the basis matrix. |
Vector3 | * ( Vector3 vector, Basis basis ) | Returns a Vector3 transformed (multiplied) by the inverse basis matrix, under the assumption that the transformation basis is orthonormal (i.e. rotation/reflection is fine, scaling/skew is not). vector * basis is equivalent to basis.Transposed() * vector . See Transposed . For transforming by inverse of a non-orthonormal basis (e.g. with scaling) basis.Inverse() * vector can be used instead. See Inverse . |
bool | == ( Basis left, Basis right ) | Returns true if the basis matrices are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | != ( Basis left, Basis right ) | Returns true if the basis matrices are not equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
EulerOrder
enum in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
Properties
Property | Description |
---|---|
Xyz | |
Xzy | |
Yxz | |
Yzx | |
Zxy | |
Zyx |
Mathf
class in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
Provides constants and static methods for common mathematical functions.
Constants
Name | Type | Value | Description |
---|---|---|---|
Tau | float | (real_t)6.2831853071795864769252867666M | The circle constant, the circumference of the unit circle in radians. |
Pi | float | (real_t)3.1415926535897932384626433833M | Constant that represents how many times the diameter of a circle fits around its perimeter. This is equivalent to Mathf.Tau / 2 . |
Inf | float | real_t.PositiveInfinity | Positive infinity. For negative infinity, use -Mathf.Inf . |
NaN | float | real_t.NaN | "Not a Number", an invalid value. NaN has special properties, including that it is not equal to itself. It is output by some invalid operations, such as dividing zero by zero. |
E | float | (real_t)2.7182818284590452353602874714M | The natural number e . |
Sqrt2 | float | (real_t)1.4142135623730950488016887242M | The square root of 2. |
Epsilon | float | EpsilonF | A very small number used for float comparison with error tolerance. 1e-06 with single-precision floats, but 1e-14 if REAL_T_IS_DOUBLE . |
Static Methods
Return Type | Signature | Description |
---|---|---|
int | Abs ( int s ) | Returns the absolute value of name (i.e. positive value). |
float | Abs ( float s ) | Returns the absolute value of name (i.e. positive value). |
double | Abs ( double s ) | Returns the absolute value of name (i.e. positive value). |
float | Acos ( float s ) | Returns the arc cosine of name in radians. Use to get the angle of cosine name . |
double | Acos ( double s ) | Returns the arc cosine of name in radians. Use to get the angle of cosine name . |
float | Acosh ( float s ) | Returns the hyperbolic arc (also called inverse) cosine of name in radians. Use it to get the angle from an angle's cosine in hyperbolic space if name is larger or equal to 1. |
double | Acosh ( double s ) | Returns the hyperbolic arc (also called inverse) cosine of name in radians. Use it to get the angle from an angle's cosine in hyperbolic space if name is larger or equal to 1. |
float | AngleDifference ( float from, float to ) | Returns the difference between the two angles, in range of - Pi , Pi . When name and name are opposite, returns - Pi if name is smaller than name , or Pi otherwise. |
double | AngleDifference ( double from, double to ) | Returns the difference between the two angles, in range of - Pi , Pi . When name and name are opposite, returns - Pi if name is smaller than name , or Pi otherwise. |
float | Asin ( float s ) | Returns the arc sine of name in radians. Use to get the angle of sine name . |
double | Asin ( double s ) | Returns the arc sine of name in radians. Use to get the angle of sine name . |
float | Asinh ( float s ) | Returns the hyperbolic arc (also called inverse) sine of name in radians. Use it to get the angle from an angle's sine in hyperbolic space if name is larger or equal to 1. |
double | Asinh ( double s ) | Returns the hyperbolic arc (also called inverse) sine of name in radians. Use it to get the angle from an angle's sine in hyperbolic space if name is larger or equal to 1. |
float | Atan ( float s ) | Returns the arc tangent of name in radians. Use to get the angle of tangent name . The method cannot know in which quadrant the angle should fall. See Atan2 if you have both y and x . |
double | Atan ( double s ) | Returns the arc tangent of name in radians. Use to get the angle of tangent name . The method cannot know in which quadrant the angle should fall. See Atan2 if you have both y and x . |
float | Atan2 ( float y, float x ) | Returns the arc tangent of name and name in radians. Use to get the angle of the tangent of y/x . To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant. Important note: The Y coordinate comes first, by convention. |
double | Atan2 ( double y, double x ) | Returns the arc tangent of name and name in radians. Use to get the angle of the tangent of y/x . To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant. Important note: The Y coordinate comes first, by convention. |
float | Atanh ( float s ) | Returns the hyperbolic arc (also called inverse) tangent of name in radians. Use it to get the angle from an angle's tangent in hyperbolic space if name is between -1 and 1 (non-inclusive). |
double | Atanh ( double s ) | Returns the hyperbolic arc (also called inverse) tangent of name in radians. Use it to get the angle from an angle's tangent in hyperbolic space if name is between -1 and 1 (non-inclusive). |
float | Ceil ( float s ) | Rounds name upward (towards positive infinity). |
double | Ceil ( double s ) | Rounds name upward (towards positive infinity). |
int | Clamp ( int value, int min, int max ) | Clamps a name so that it is not less than name and not more than name . |
float | Clamp ( float value, float min, float max ) | Clamps a name so that it is not less than name and not more than name . |
double | Clamp ( double value, double min, double max ) | Clamps a name so that it is not less than name and not more than name . |
float | Cos ( float s ) | Returns the cosine of angle name in radians. |
double | Cos ( double s ) | Returns the cosine of angle name in radians. |
float | Cosh ( float s ) | Returns the hyperbolic cosine of angle name in radians. |
double | Cosh ( double s ) | Returns the hyperbolic cosine of angle name in radians. |
float | CubicInterpolate ( float from, float to, float pre, float post, float weight ) | Cubic interpolates between two values by the factor defined in name with pre and post values. |
double | CubicInterpolate ( double from, double to, double pre, double post, double weight ) | Cubic interpolates between two values by the factor defined in name with pre and post values. |
float | CubicInterpolateAngle ( float from, float to, float pre, float post, float weight ) | Cubic interpolates between two rotation values with shortest path by the factor defined in name with pre and post values. See also LerpAngle . |
double | CubicInterpolateAngle ( double from, double to, double pre, double post, double weight ) | Cubic interpolates between two rotation values with shortest path by the factor defined in name with pre and post values. See also LerpAngle . |
float | CubicInterpolateInTime ( float from, float to, float pre, float post, float weight, float toT, float preT, float postT ) | Cubic interpolates between two values by the factor defined in name with pre and post values. It can perform smoother interpolation than CubicInterpolate by the time values. |
double | CubicInterpolateInTime ( double from, double to, double pre, double post, double weight, double toT, double preT, double postT ) | Cubic interpolates between two values by the factor defined in name with pre and post values. It can perform smoother interpolation than CubicInterpolate by the time values. |
float | CubicInterpolateAngleInTime ( float from, float to, float pre, float post, float weight, float toT, float preT, float postT ) | Cubic interpolates between two rotation values with shortest path by the factor defined in name with pre and post values. See also LerpAngle . It can perform smoother interpolation than CubicInterpolateAngle by the time values. |
double | CubicInterpolateAngleInTime ( double from, double to, double pre, double post, double weight, double toT, double preT, double postT ) | Cubic interpolates between two rotation values with shortest path by the factor defined in name with pre and post values. See also LerpAngle . It can perform smoother interpolation than CubicInterpolateAngle by the time values. |
float | BezierInterpolate ( float start, float control1, float control2, float end, float t ) | Returns the point at the given name on a one-dimensional Bezier curve defined by the given name , name , and name points. |
double | BezierInterpolate ( double start, double control1, double control2, double end, double t ) | Returns the point at the given name on a one-dimensional Bezier curve defined by the given name , name , and name points. |
float | BezierDerivative ( float start, float control1, float control2, float end, float t ) | Returns the derivative at the given name on a one dimensional Bezier curve defined by the given name , name , and name points. |
double | BezierDerivative ( double start, double control1, double control2, double end, double t ) | Returns the derivative at the given name on a one dimensional Bezier curve defined by the given name , name , and name points. |
float | DbToLinear ( float db ) | Converts from decibels to linear energy (audio). |
double | DbToLinear ( double db ) | Converts from decibels to linear energy (audio). |
float | DegToRad ( float deg ) | Converts an angle expressed in degrees to radians. |
double | DegToRad ( double deg ) | Converts an angle expressed in degrees to radians. |
float | Ease ( float s, float curve ) | Easing function, based on exponent. The name values are: 0 is constant, 1 is linear, 0 to 1 is ease-in, 1 or more is ease-out. Negative values are in-out/out-in. |
double | Ease ( double s, double curve ) | Easing function, based on exponent. The name values are: 0 is constant, 1 is linear, 0 to 1 is ease-in, 1 or more is ease-out. Negative values are in-out/out-in. |
float | Exp ( float s ) | The natural exponential function. It raises the mathematical constant e to the power of name and returns it. |
double | Exp ( double s ) | The natural exponential function. It raises the mathematical constant e to the power of name and returns it. |
float | Floor ( float s ) | Rounds name downward (towards negative infinity). |
double | Floor ( double s ) | Rounds name downward (towards negative infinity). |
float | InverseLerp ( float from, float to, float weight ) | Returns a normalized value considering the given range. This is the opposite of Lerp . |
double | InverseLerp ( double from, double to, double weight ) | Returns a normalized value considering the given range. This is the opposite of Lerp . |
bool | IsEqualApprox ( float a, float b ) | Returns true if name and name are approximately equal to each other. The comparison is done using a tolerance calculation with Epsilon . |
bool | IsEqualApprox ( double a, double b ) | Returns true if name and name are approximately equal to each other. The comparison is done using a tolerance calculation with Epsilon . |
bool | IsFinite ( float s ) | Returns whether name is a finite value, i.e. it is not NaN , positive infinite, or negative infinity. |
bool | IsFinite ( double s ) | Returns whether name is a finite value, i.e. it is not NaN , positive infinite, or negative infinity. |
bool | IsInf ( float s ) | Returns whether name is an infinity value (either positive infinity or negative infinity). |
bool | IsInf ( double s ) | Returns whether name is an infinity value (either positive infinity or negative infinity). |
bool | IsNaN ( float s ) | Returns whether name is a NaN ("Not a Number" or invalid) value. |
bool | IsNaN ( double s ) | Returns whether name is a NaN ("Not a Number" or invalid) value. |
bool | IsZeroApprox ( float s ) | Returns true if name is zero or almost zero. The comparison is done using a tolerance calculation with Epsilon . This method is faster than using IsEqualApprox with one value as zero. |
bool | IsZeroApprox ( double s ) | Returns true if name is zero or almost zero. The comparison is done using a tolerance calculation with Epsilon . This method is faster than using IsEqualApprox with one value as zero. |
float | Lerp ( float from, float to, float weight ) | Linearly interpolates between two values by a normalized value. This is the opposite InverseLerp . |
double | Lerp ( double from, double to, double weight ) | Linearly interpolates between two values by a normalized value. This is the opposite InverseLerp . |
float | LerpAngle ( float from, float to, float weight ) | Linearly interpolates between two angles (in radians) by a normalized value. Similar to Lerp , but interpolates correctly when the angles wrap around Tau . |
double | LerpAngle ( double from, double to, double weight ) | Linearly interpolates between two angles (in radians) by a normalized value. Similar to Lerp , but interpolates correctly when the angles wrap around Tau . |
float | LinearToDb ( float linear ) | Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear). |
double | LinearToDb ( double linear ) | Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear). |
float | Log ( float s ) | Natural logarithm. The amount of time needed to reach a certain level of continuous growth. Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm. |
double | Log ( double s ) | Natural logarithm. The amount of time needed to reach a certain level of continuous growth. Note: This is not the same as the "log" function on most calculators, which uses a base 10 logarithm. |
int | Max ( int a, int b ) | Returns the maximum of two values. |
float | Max ( float a, float b ) | Returns the maximum of two values. |
double | Max ( double a, double b ) | Returns the maximum of two values. |
int | Min ( int a, int b ) | Returns the minimum of two values. |
float | Min ( float a, float b ) | Returns the minimum of two values. |
double | Min ( double a, double b ) | Returns the minimum of two values. |
float | MoveToward ( float from, float to, float delta ) | Moves name toward name by the name value. Use a negative name value to move away. |
double | MoveToward ( double from, double to, double delta ) | Moves name toward name by the name value. Use a negative name value to move away. |
int | NearestPo2 ( int value ) | Returns the nearest larger power of 2 for the integer name . |
int | PosMod ( int a, int b ) | Performs a canonical Modulus operation, where the output is on the range [0, name ). |
float | PosMod ( float a, float b ) | Performs a canonical Modulus operation, where the output is on the range [0, name ). |
double | PosMod ( double a, double b ) | Performs a canonical Modulus operation, where the output is on the range [0, name ). |
float | Pow ( float x, float y ) | Returns the result of name raised to the power of name . |
double | Pow ( double x, double y ) | Returns the result of name raised to the power of name . |
float | RadToDeg ( float rad ) | Converts an angle expressed in radians to degrees. |
double | RadToDeg ( double rad ) | Converts an angle expressed in radians to degrees. |
float | Remap ( float value, float inFrom, float inTo, float outFrom, float outTo ) | Maps a name from [ name , name ] to [ name , name ]. |
double | Remap ( double value, double inFrom, double inTo, double outFrom, double outTo ) | Maps a name from [ name , name ] to [ name , name ]. |
float | RotateToward ( float from, float to, float delta ) | Rotates name toward name by the name amount. Will not go past name . Similar to MoveToward but interpolates correctly when the angles wrap around Tau . If name is negative, this function will rotate away from name , toward the opposite angle, and will not go past the opposite angle. |
double | RotateToward ( double from, double to, double delta ) | Rotates name toward name by the name amount. Will not go past name . Similar to MoveToward but interpolates correctly when the angles wrap around Tau . If name is negative, this function will rotate away from name , toward the opposite angle, and will not go past the opposite angle. |
float | Round ( float s ) | Rounds name to the nearest whole number, with halfway cases rounded towards the nearest multiple of two. |
double | Round ( double s ) | Rounds name to the nearest whole number, with halfway cases rounded towards the nearest multiple of two. |
int | Sign ( int s ) | Returns the sign of name : -1 or 1 . Returns 0 if name is 0 . |
int | Sign ( float s ) | Returns the sign of name : -1 or 1 . Returns 0 if name is 0 . |
int | Sign ( double s ) | Returns the sign of name : -1 or 1 . Returns 0 if name is 0 . |
float | Sin ( float s ) | Returns the sine of angle name in radians. |
double | Sin ( double s ) | Returns the sine of angle name in radians. |
float | Sinh ( float s ) | Returns the hyperbolic sine of angle name in radians. |
double | Sinh ( double s ) | Returns the hyperbolic sine of angle name in radians. |
float | SmoothStep ( float from, float to, float weight ) | Returns a number smoothly interpolated between name and name , based on the name . Similar to Lerp , but interpolates faster at the beginning and slower at the end. |
double | SmoothStep ( double from, double to, double weight ) | Returns a number smoothly interpolated between name and name , based on the name . Similar to Lerp , but interpolates faster at the beginning and slower at the end. |
float | Sqrt ( float s ) | Returns the square root of name , where name is a non-negative number. If you need negative inputs, use System.Numerics.Complex . |
double | Sqrt ( double s ) | Returns the square root of name , where name is a non-negative number. If you need negative inputs, use System.Numerics.Complex . |
int | StepDecimals ( double step ) | Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation. |
float | Snapped ( float s, float step ) | Snaps float value name to a given name . This can also be used to round a floating point number to an arbitrary number of decimals. |
double | Snapped ( double s, double step ) | Snaps float value name to a given name . This can also be used to round a floating point number to an arbitrary number of decimals. |
float | Tan ( float s ) | Returns the tangent of angle name in radians. |
double | Tan ( double s ) | Returns the tangent of angle name in radians. |
float | Tanh ( float s ) | Returns the hyperbolic tangent of angle name in radians. |
double | Tanh ( double s ) | Returns the hyperbolic tangent of angle name in radians. |
int | Wrap ( int value, int min, int max ) | Wraps name between name and name . Usable for creating loop-alike behavior or infinite surfaces. If name is 0 , this is equivalent to PosMod , so prefer using that instead. |
float | Wrap ( float value, float min, float max ) | Wraps name between name and name . Usable for creating loop-alike behavior or infinite surfaces. If name is 0 , this is equivalent to PosMod , so prefer using that instead. |
double | Wrap ( double value, double min, double max ) | Wraps name between name and name . Usable for creating loop-alike behavior or infinite surfaces. If name is 0 , this is equivalent to PosMod , so prefer using that instead. |
float | PingPong ( float value, float length ) | Returns the name wrapped between 0 and the name . If the limit is reached, the next value the function returned is decreased to the 0 side or increased to the name side (like a triangle wave). If name is less than zero, it becomes positive. |
double | PingPong ( double value, double length ) | Returns the name wrapped between 0 and the name . If the limit is reached, the next value the function returned is decreased to the 0 side or increased to the name side (like a triangle wave). If name is less than zero, it becomes positive. |
int | DecimalCount ( double s ) | Returns the amount of digits after the decimal place. |
int | DecimalCount ( decimal s ) | Returns the amount of digits after the decimal place. |
int | CeilToInt ( float s ) | Rounds name upward (towards positive infinity). This is the same as Ceil , but returns an int . |
int | CeilToInt ( double s ) | Rounds name upward (towards positive infinity). This is the same as Ceil , but returns an int . |
int | FloorToInt ( float s ) | Rounds name downward (towards negative infinity). This is the same as Floor , but returns an int . |
int | FloorToInt ( double s ) | Rounds name downward (towards negative infinity). This is the same as Floor , but returns an int . |
int | RoundToInt ( float s ) | Rounds name to the nearest whole number. This is the same as Round , but returns an int . |
int | RoundToInt ( double s ) | Rounds name to the nearest whole number. This is the same as Round , but returns an int . |
(float Sin, float Cos) | SinCos ( float s ) | Returns the sine and cosine of angle name in radians. |
(double Sin, double Cos) | SinCos ( double s ) | Returns the sine and cosine of angle name in radians. |
bool | IsEqualApprox ( float a, float b, float tolerance ) | Returns true if name and name are approximately equal to each other. The comparison is done using the provided tolerance value. If you want the tolerance to be calculated for you, use IsEqualApprox . |
bool | IsEqualApprox ( double a, double b, double tolerance ) | Returns true if name and name are approximately equal to each other. The comparison is done using the provided tolerance value. If you want the tolerance to be calculated for you, use IsEqualApprox . |
Quaternion
struct in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
A unit quaternion used for representing 3D rotations. Quaternions need to be normalized to be used for rotation.
It is similar to
Basis
, which implements matrix
representation of rotations, and can be parametrized using both
an axis-angle pair or Euler angles. Basis stores rotation, scale,
and shearing, while Quaternion only stores rotation.
Due to its compactness and the way it is stored in memory, certain operations (obtaining axis-angle and performing SLERP, in particular) are more efficient and robust against floating-point errors.
Constructors
Signature | Description |
---|---|
( float x, float y, float z, float w ) | Constructs a Quaternion defined by the given values. |
( Basis basis ) | Constructs a Quaternion from the given Basis . |
( Vector3 axis, float angle ) | Constructs a Quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector. |
( Vector3 arcFrom, Vector3 arcTo ) |
Methods
Return Type | Signature | Description |
---|---|---|
float | AngleTo ( Quaternion to ) | Returns the angle between this quaternion and name . This is the magnitude of the angle you would need to rotate by to get from one to the other. Note: This method has an abnormally high amount of floating-point error, so methods such as Mathf.IsZeroApprox(real_t) will not work reliably. |
Quaternion | SphericalCubicInterpolate ( Quaternion b, Quaternion preA, Quaternion postB, float weight ) | Performs a spherical cubic interpolation between quaternions name , this quaternion, name , and name , by the given amount name . |
Quaternion | SphericalCubicInterpolateInTime ( Quaternion b, Quaternion preA, Quaternion postB, float weight, float bT, float preAT, float postBT ) | Performs a spherical cubic interpolation between quaternions name , this quaternion, name , and name , by the given amount name . It can perform smoother interpolation than SphericalCubicInterpolate by the time values. |
float | Dot ( Quaternion b ) | Returns the dot product of two quaternions. |
Quaternion | Exp ( ) | |
float | GetAngle ( ) | |
Vector3 | GetAxis ( ) | |
Vector3 | GetEuler ( EulerOrder order ) | Returns Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle). |
Quaternion | Inverse ( ) | Returns the inverse of the quaternion. |
bool | IsFinite ( ) | Returns true if this quaternion is finite, by calling Mathf.IsFinite(real_t) on each component. |
bool | IsNormalized ( ) | Returns whether the quaternion is normalized or not. |
Quaternion | Log ( ) | |
float | Length ( ) | Returns the length (magnitude) of the quaternion. Equivalent to Mathf.Sqrt(LengthSquared) . |
float | LengthSquared ( ) | Returns the squared length (squared magnitude) of the quaternion. This method runs faster than Length , so prefer it if you need to compare quaternions or need the squared length for some formula. Equivalent to Dot(this) . |
Quaternion | Normalized ( ) | Returns a copy of the quaternion, normalized to unit length. |
Quaternion | Slerp ( Quaternion to, float weight ) | Returns the result of the spherical linear interpolation between this quaternion and name by amount name . Note: Both quaternions must be normalized. |
Quaternion | Slerpni ( Quaternion to, float weight ) | Returns the result of the spherical linear interpolation between this quaternion and name by amount name , but without checking if the rotation path is not bigger than 90 degrees. |
bool | Equals ( object? obj ) | Returns true if this quaternion and name are equal. |
bool | Equals ( Quaternion other ) | Returns true if this quaternion and name are equal. |
bool | IsEqualApprox ( Quaternion other ) | Returns true if this quaternion and name are approximately equal, by running Mathf.IsEqualApprox(real_t, real_t) on each component. |
int | GetHashCode ( ) | Serves as the hash function for Quaternion . |
string | ToString ( ) | Converts this Quaternion to a string. |
string | ToString ( string? format ) | Converts this Quaternion to a string with the given name . |
Constants
Name | Type | Description | Initializer |
---|---|---|---|
Identity | Quaternion | The identity quaternion, representing no rotation. Equivalent to an identity Basis matrix. If a vector is transformed by an identity quaternion, it will not change. Equivalent to new Quaternion(0, 0, 0, 1) . | new(0, 0, 0, 1) |
Static Methods
Return Type | Signature | Description |
---|---|---|
Quaternion | FromEuler ( Vector3 eulerYXZ ) | Constructs a Quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle). |
Operators
Return Type | Signature | Description |
---|---|---|
Quaternion | * ( Quaternion left, Quaternion right ) | Composes these two quaternions by multiplying them together. This has the effect of rotating the second quaternion (the child) by the first quaternion (the parent). |
Vector3 | * ( Quaternion quaternion, Vector3 vector ) | Returns a Vector3 rotated (multiplied) by the quaternion. |
Vector3 | * ( Vector3 vector, Quaternion quaternion ) | Returns a Vector3 rotated (multiplied) by the inverse quaternion. vector * quaternion is equivalent to quaternion.Inverse() * vector . See Inverse . |
Quaternion | + ( Quaternion left, Quaternion right ) | Adds each component of the left Quaternion to the right Quaternion . This operation is not meaningful on its own, but it can be used as a part of a larger expression, such as approximating an intermediate rotation between two nearby rotations. |
Quaternion | - ( Quaternion left, Quaternion right ) | Subtracts each component of the left Quaternion by the right Quaternion . This operation is not meaningful on its own, but it can be used as a part of a larger expression. |
Quaternion | - ( Quaternion quat ) | Returns the negative value of the Quaternion . This is the same as writing new Quaternion(-q.X, -q.Y, -q.Z, -q.W) . This operation results in a quaternion that represents the same rotation. |
Quaternion | * ( Quaternion left, float right ) | Multiplies each component of the Quaternion by the given real_t . This operation is not meaningful on its own, but it can be used as a part of a larger expression. |
Quaternion | * ( float left, Quaternion right ) | Multiplies each component of the Quaternion by the given real_t . This operation is not meaningful on its own, but it can be used as a part of a larger expression. |
Quaternion | / ( Quaternion left, float right ) | Divides each component of the Quaternion by the given real_t . This operation is not meaningful on its own, but it can be used as a part of a larger expression. |
bool | == ( Quaternion left, Quaternion right ) | Returns true if the quaternions are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | != ( Quaternion left, Quaternion right ) | Returns true if the quaternions are not equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
Vector2
struct in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
2-element structure that can be used to represent positions in 2D space or any other pair of numeric values.
Constructors
Signature | Description |
---|---|
( float x, float y ) | Constructs a new Vector2 with the given components. |
Methods
Return Type | Signature | Description |
---|---|---|
void | Deconstruct ( float x, float y ) | Helper method for deconstruction into a tuple. |
Vector2 | Abs ( ) | Returns a new vector with all components in absolute values (i.e. positive). |
float | Angle ( ) | Returns this vector's angle with respect to the X axis, or (1, 0) vector, in radians. Equivalent to the result of Mathf.Atan2(real_t, real_t) when called with the vector's Y and X as parameters: Mathf.Atan2(v.Y, v.X) . |
float | AngleTo ( Vector2 to ) | Returns the angle to the given vector, in radians. |
float | AngleToPoint ( Vector2 to ) | Returns the angle between the line connecting the two points and the X axis, in radians. |
float | Aspect ( ) | Returns the aspect ratio of this vector, the ratio of X to Y . |
Vector2 | Bounce ( Vector2 normal ) | Returns the vector "bounced off" from a plane defined by the given normal. |
Vector2 | Ceil ( ) | Returns a new vector with all components rounded up (towards positive infinity). |
Vector2 | Clamp ( Vector2 min, Vector2 max ) | Returns a new vector with all components clamped between the components of name and name using Mathf.Clamp(real_t, real_t, real_t) . |
Vector2 | Clamp ( float min, float max ) | Returns a new vector with all components clamped between the name and name using Mathf.Clamp(real_t, real_t, real_t) . |
float | Cross ( Vector2 with ) | Returns the cross product of this vector and name . |
Vector2 | CubicInterpolate ( Vector2 b, Vector2 preA, Vector2 postB, float weight ) | Performs a cubic interpolation between vectors name , this vector, name , and name , by the given amount name . |
Vector2 | CubicInterpolateInTime ( Vector2 b, Vector2 preA, Vector2 postB, float weight, float t, float preAT, float postBT ) | Performs a cubic interpolation between vectors name , this vector, name , and name , by the given amount name . It can perform smoother interpolation than CubicInterpolate by the time values. |
Vector2 | BezierInterpolate ( Vector2 control1, Vector2 control2, Vector2 end, float t ) | Returns the point at the given name on a one-dimensional Bezier curve defined by this vector and the given name , name , and name points. |
Vector2 | BezierDerivative ( Vector2 control1, Vector2 control2, Vector2 end, float t ) | Returns the derivative at the given name on the Bezier curve defined by this vector and the given name , name , and name points. |
Vector2 | DirectionTo ( Vector2 to ) | Returns the normalized vector pointing from this vector to name . |
float | DistanceSquaredTo ( Vector2 to ) | Returns the squared distance between this vector and name . This method runs faster than DistanceTo , so prefer it if you need to compare vectors or need the squared distance for some formula. |
float | DistanceTo ( Vector2 to ) | Returns the distance between this vector and name . |
float | Dot ( Vector2 with ) | Returns the dot product of this vector and name . |
Vector2 | Floor ( ) | Returns a new vector with all components rounded down (towards negative infinity). |
Vector2 | Inverse ( ) | Returns the inverse of this vector. This is the same as new Vector2(1 / v.X, 1 / v.Y) . |
bool | IsFinite ( ) | Returns true if this vector is finite, by calling Mathf.IsFinite(real_t) on each component. |
bool | IsNormalized ( ) | Returns true if the vector is normalized, and false otherwise. |
float | Length ( ) | Returns the length (magnitude) of this vector. |
float | LengthSquared ( ) | Returns the squared length (squared magnitude) of this vector. This method runs faster than Length , so prefer it if you need to compare vectors or need the squared length for some formula. |
Vector2 | Lerp ( Vector2 to, float weight ) | Returns the result of the linear interpolation between this vector and name by amount name . |
Vector2 | LimitLength ( float length ) | Returns the vector with a maximum length by limiting its length to name . |
Vector2 | Max ( Vector2 with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector2(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y)) . |
Vector2 | Max ( float with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector2(Mathf.Max(X, with), Mathf.Max(Y, with)) . |
Vector2 | Min ( Vector2 with ) | Returns the result of the component-wise minimum between this vector and name . Equivalent to new Vector2(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y)) . |
Vector2 | Min ( float with ) | Returns the result of the component-wise minimum between this vector and name . Equivalent to new Vector2(Mathf.Min(X, with), Mathf.Min(Y, with)) . |
Axis | MaxAxisIndex ( ) | Returns the axis of the vector's highest value. See Axis . If both components are equal, this method returns Axis.X . |
Axis | MinAxisIndex ( ) | Returns the axis of the vector's lowest value. See Axis . If both components are equal, this method returns Axis.Y . |
Vector2 | MoveToward ( Vector2 to, float delta ) | Moves this vector toward name by the fixed name amount. |
Vector2 | Normalized ( ) | Returns the vector scaled to unit length. Equivalent to v / v.Length() . |
Vector2 | PosMod ( float mod ) | Returns a vector composed of the Mathf.PosMod(real_t, real_t) of this vector's components and name . |
Vector2 | PosMod ( Vector2 modv ) | Returns a vector composed of the Mathf.PosMod(real_t, real_t) of this vector's components and name 's components. |
Vector2 | Project ( Vector2 onNormal ) | Returns a new vector resulting from projecting this vector onto the given vector name . The resulting new vector is parallel to name . See also Slide . Note: If the vector name is a zero vector, the components of the resulting new vector will be real_t.NaN . |
Vector2 | Reflect ( Vector2 normal ) | Returns this vector reflected from a plane defined by the given name . |
Vector2 | Rotated ( float angle ) | Rotates this vector by name radians. |
Vector2 | Round ( ) | Returns this vector with all components rounded to the nearest integer, with halfway cases rounded towards the nearest multiple of two. |
Vector2 | Sign ( ) | Returns a vector with each component set to one or negative one, depending on the signs of this vector's components, or zero if the component is zero, by calling Mathf.Sign(real_t) on each component. |
Vector2 | Slerp ( Vector2 to, float weight ) | Returns the result of the spherical linear interpolation between this vector and name by amount name . This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like Lerp . |
Vector2 | Slide ( Vector2 normal ) | Returns a new vector resulting from sliding this vector along a line with normal name . The resulting new vector is perpendicular to name , and is equivalent to this vector minus its projection on name . See also Project . Note: The vector name must be normalized. See also Normalized . |
Vector2 | Snapped ( Vector2 step ) | Returns a new vector with each component snapped to the nearest multiple of the corresponding component in name . This can also be used to round to an arbitrary number of decimals. |
Vector2 | Snapped ( float step ) | Returns a new vector with each component snapped to the nearest multiple of name . This can also be used to round to an arbitrary number of decimals. |
Vector2 | Orthogonal ( ) | Returns a perpendicular vector rotated 90 degrees counter-clockwise compared to the original, with the same length. |
bool | Equals ( object? obj ) | Returns true if the vector is exactly equal to the given object ( name ). Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | Equals ( Vector2 other ) | Returns true if the vectors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | IsEqualApprox ( Vector2 other ) | Returns true if this vector and name are approximately equal, by running Mathf.IsEqualApprox(real_t, real_t) on each component. |
bool | IsZeroApprox ( ) | Returns true if this vector's values are approximately zero, by running Mathf.IsZeroApprox(real_t) on each component. This method is faster than using IsEqualApprox with one value as a zero vector. |
int | GetHashCode ( ) | Serves as the hash function for Vector2 . |
string | ToString ( ) | Converts this Vector2 to a string. |
string | ToString ( string? format ) | Converts this Vector2 to a string with the given name . |
Constants
Name | Type | Description | Initializer |
---|---|---|---|
Zero | Vector2 | Zero vector, a vector with all components set to 0 . Equivalent to new Vector2(0, 0) . | new(0, 0) |
One | Vector2 | One vector, a vector with all components set to 1 . Equivalent to new Vector2(1, 1) . | new(1, 1) |
Inf | Vector2 | Infinity vector, a vector with all components set to Mathf.Inf . Equivalent to new Vector2(Mathf.Inf, Mathf.Inf) . | new(Mathf.Inf, Mathf.Inf) |
Up | Vector2 | Up unit vector. Y is down in 2D, so this vector points -Y. Equivalent to new Vector2(0, -1) . | new(0, -1) |
Down | Vector2 | Down unit vector. Y is down in 2D, so this vector points +Y. Equivalent to new Vector2(0, 1) . | new(0, 1) |
Right | Vector2 | Right unit vector. Represents the direction of right. Equivalent to new Vector2(1, 0) . | new(1, 0) |
Left | Vector2 | Left unit vector. Represents the direction of left. Equivalent to new Vector2(-1, 0) . | new(-1, 0) |
Static Methods
Return Type | Signature | Description |
---|---|---|
Vector2 | FromAngle ( float angle ) | Creates a unit Vector2 rotated to the given angle. This is equivalent to doing Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) or Vector2.Right.Rotated(angle) . |
Operators
Return Type | Signature | Description |
---|---|---|
Vector2 | + ( Vector2 left, Vector2 right ) | Adds each component of the Vector2 with the components of the given Vector2 . |
Vector2 | - ( Vector2 left, Vector2 right ) | Subtracts each component of the Vector2 by the components of the given Vector2 . |
Vector2 | - ( Vector2 vec ) | Returns the negative value of the Vector2 . This is the same as writing new Vector2(-v.X, -v.Y) . This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative. |
Vector2 | * ( Vector2 vec, float scale ) | Multiplies each component of the Vector2 by the given real_t . |
Vector2 | * ( float scale, Vector2 vec ) | Multiplies each component of the Vector2 by the given real_t . |
Vector2 | * ( Vector2 left, Vector2 right ) | Multiplies each component of the Vector2 by the components of the given Vector2 . |
Vector2 | / ( Vector2 vec, float divisor ) | Divides each component of the Vector2 by the given real_t . |
Vector2 | / ( Vector2 vec, Vector2 divisorv ) | Divides each component of the Vector2 by the components of the given Vector2 . |
Vector2 | % ( Vector2 vec, float divisor ) | Gets the remainder of each component of the Vector2 with the components of the given real_t . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using PosMod instead if you want to handle negative numbers. |
Vector2 | % ( Vector2 vec, Vector2 divisorv ) | Gets the remainder of each component of the Vector2 with the components of the given Vector2 . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using PosMod instead if you want to handle negative numbers. |
bool | == ( Vector2 left, Vector2 right ) | Returns true if the vectors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | != ( Vector2 left, Vector2 right ) | Returns true if the vectors are not equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | < ( Vector2 left, Vector2 right ) | Compares two Vector2 vectors by first checking if the X value of the name vector is less than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | > ( Vector2 left, Vector2 right ) | Compares two Vector2 vectors by first checking if the X value of the name vector is greater than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | <= ( Vector2 left, Vector2 right ) | Compares two Vector2 vectors by first checking if the X value of the name vector is less than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | >= ( Vector2 left, Vector2 right ) | Compares two Vector2 vectors by first checking if the X value of the name vector is greater than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
Vector2I
struct in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
2-element structure that can be used to represent 2D grid coordinates or pairs of integers.
Constructors
Signature | Description |
---|---|
( int x, int y ) | Constructs a new Vector2I with the given components. |
Methods
Return Type | Signature | Description |
---|---|---|
void | Deconstruct ( int x, int y ) | Helper method for deconstruction into a tuple. |
Vector2I | Abs ( ) | Returns a new vector with all components in absolute values (i.e. positive). |
float | Aspect ( ) | Returns the aspect ratio of this vector, the ratio of X to Y . |
Vector2I | Clamp ( Vector2I min, Vector2I max ) | Returns a new vector with all components clamped between the components of name and name using Mathf.Clamp(int, int, int) . |
Vector2I | Clamp ( int min, int max ) | Returns a new vector with all components clamped between the name and name using Mathf.Clamp(int, int, int) . |
int | DistanceSquaredTo ( Vector2I to ) | Returns the squared distance between this vector and name . This method runs faster than DistanceTo , so prefer it if you need to compare vectors or need the squared distance for some formula. |
float | DistanceTo ( Vector2I to ) | Returns the distance between this vector and name . |
float | Length ( ) | Returns the length (magnitude) of this vector. |
int | LengthSquared ( ) | Returns the squared length (squared magnitude) of this vector. This method runs faster than Length , so prefer it if you need to compare vectors or need the squared length for some formula. |
Vector2I | Max ( Vector2I with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector2I(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y)) . |
Vector2I | Max ( int with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector2I(Mathf.Max(X, with), Mathf.Max(Y, with)) . |
Vector2I | Min ( Vector2I with ) | Returns the result of the component-wise minimum between this vector and name . Equivalent to new Vector2I(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y)) . |
Vector2I | Min ( int with ) | Returns the result of the component-wise minimum between this vector and name . Equivalent to new Vector2I(Mathf.Min(X, with), Mathf.Min(Y, with)) . |
Axis | MaxAxisIndex ( ) | Returns the axis of the vector's highest value. See Axis . If both components are equal, this method returns Axis.X . |
Axis | MinAxisIndex ( ) | Returns the axis of the vector's lowest value. See Axis . If both components are equal, this method returns Axis.Y . |
Vector2I | Sign ( ) | Returns a vector with each component set to one or negative one, depending on the signs of this vector's components, or zero if the component is zero, by calling Mathf.Sign(int) on each component. |
Vector2I | Snapped ( Vector2I step ) | Returns a new vector with each component snapped to the closest multiple of the corresponding component in name . |
Vector2I | Snapped ( int step ) | Returns a new vector with each component snapped to the closest multiple of name . |
bool | Equals ( object? obj ) | Returns true if the vector is equal to the given object ( name ). |
bool | Equals ( Vector2I other ) | Returns true if the vectors are equal. |
int | GetHashCode ( ) | Serves as the hash function for Vector2I . |
string | ToString ( ) | Converts this Vector2I to a string. |
string | ToString ( string? format ) | Converts this Vector2I to a string with the given name . |
Constants
Name | Type | Description | Initializer |
---|---|---|---|
MinValue | Vector2I | Min vector, a vector with all components equal to int.MinValue . Can be used as a negative integer equivalent of Vector2.Inf . Equivalent to new Vector2I(int.MinValue, int.MinValue) . | new(int.MinValue, int.MinValue) |
MaxValue | Vector2I | Max vector, a vector with all components equal to int.MaxValue . Can be used as an integer equivalent of Vector2.Inf . Equivalent to new Vector2I(int.MaxValue, int.MaxValue) . | new(int.MaxValue, int.MaxValue) |
Zero | Vector2I | Zero vector, a vector with all components set to 0 . Equivalent to new Vector2I(0, 0) . | new(0, 0) |
One | Vector2I | One vector, a vector with all components set to 1 . Equivalent to new Vector2I(1, 1) . | new(1, 1) |
Up | Vector2I | Up unit vector. Y is down in 2D, so this vector points -Y. Equivalent to new Vector2I(0, -1) . | new(0, -1) |
Down | Vector2I | Down unit vector. Y is down in 2D, so this vector points +Y. Equivalent to new Vector2I(0, 1) . | new(0, 1) |
Right | Vector2I | Right unit vector. Represents the direction of right. Equivalent to new Vector2I(1, 0) . | new(1, 0) |
Left | Vector2I | Left unit vector. Represents the direction of left. Equivalent to new Vector2I(-1, 0) . | new(-1, 0) |
Operators
Return Type | Signature | Description |
---|---|---|
Vector2I | + ( Vector2I left, Vector2I right ) | Adds each component of the Vector2I with the components of the given Vector2I . |
Vector2I | - ( Vector2I left, Vector2I right ) | Subtracts each component of the Vector2I by the components of the given Vector2I . |
Vector2I | - ( Vector2I vec ) | Returns the negative value of the Vector2I . This is the same as writing new Vector2I(-v.X, -v.Y) . This operation flips the direction of the vector while keeping the same magnitude. |
Vector2I | * ( Vector2I vec, int scale ) | Multiplies each component of the Vector2I by the given int . |
Vector2I | * ( int scale, Vector2I vec ) | Multiplies each component of the Vector2I by the given int . |
Vector2I | * ( Vector2I left, Vector2I right ) | Multiplies each component of the Vector2I by the components of the given Vector2I . |
Vector2I | / ( Vector2I vec, int divisor ) | Divides each component of the Vector2I by the given int . |
Vector2I | / ( Vector2I vec, Vector2I divisorv ) | Divides each component of the Vector2I by the components of the given Vector2I . |
Vector2I | % ( Vector2I vec, int divisor ) | Gets the remainder of each component of the Vector2I with the components of the given int . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using Mathf.PosMod(int, int) instead if you want to handle negative numbers. |
Vector2I | % ( Vector2I vec, Vector2I divisorv ) | Gets the remainder of each component of the Vector2I with the components of the given Vector2I . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using Mathf.PosMod(int, int) instead if you want to handle negative numbers. |
bool | == ( Vector2I left, Vector2I right ) | Returns true if the vectors are equal. |
bool | != ( Vector2I left, Vector2I right ) | Returns true if the vectors are not equal. |
bool | < ( Vector2I left, Vector2I right ) | Compares two Vector2I vectors by first checking if the X value of the name vector is less than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | > ( Vector2I left, Vector2I right ) | Compares two Vector2I vectors by first checking if the X value of the name vector is greater than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | <= ( Vector2I left, Vector2I right ) | Compares two Vector2I vectors by first checking if the X value of the name vector is less than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
bool | >= ( Vector2I left, Vector2I right ) | Compares two Vector2I vectors by first checking if the X value of the name vector is greater than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors. This operator is useful for sorting vectors. |
Vector3
struct in Math
Description
(code of this item is picked from Godot Engine in compliance with MIT license).
3-element structure that can be used to represent positions in 3D space or any other pair of numeric values.
Constructors
Signature | Description |
---|---|
( float x, float y, float z ) | Constructs a new Vector3 with the given components. |
Methods
Return Type | Signature | Description |
---|---|---|
void | Deconstruct ( float x, float y, float z ) | Helper method for deconstruction into a tuple. |
Vector3 | Abs ( ) | Returns a new vector with all components in absolute values (i.e. positive). |
float | AngleTo ( Vector3 to ) | Returns the unsigned minimum angle to the given vector, in radians. |
Vector3 | Bounce ( Vector3 normal ) | Returns this vector "bounced off" from a plane defined by the given normal. |
Vector3 | Ceil ( ) | Returns a new vector with all components rounded up (towards positive infinity). |
Vector3 | Clamp ( Vector3 min, Vector3 max ) | Returns a new vector with all components clamped between the components of name and name using Mathf.Clamp(real_t, real_t, real_t) . |
Vector3 | Clamp ( float min, float max ) | Returns a new vector with all components clamped between the name and name using Mathf.Clamp(real_t, real_t, real_t) . |
Vector3 | Cross ( Vector3 with ) | Returns the cross product of this vector and name . |
Vector3 | CubicInterpolate ( Vector3 b, Vector3 preA, Vector3 postB, float weight ) | Performs a cubic interpolation between vectors name , this vector, name , and name , by the given amount name . |
Vector3 | CubicInterpolateInTime ( Vector3 b, Vector3 preA, Vector3 postB, float weight, float t, float preAT, float postBT ) | Performs a cubic interpolation between vectors name , this vector, name , and name , by the given amount name . It can perform smoother interpolation than CubicInterpolate by the time values. |
Vector3 | BezierInterpolate ( Vector3 control1, Vector3 control2, Vector3 end, float t ) | Returns the point at the given name on a one-dimensional Bezier curve defined by this vector and the given name , name , and name points. |
Vector3 | BezierDerivative ( Vector3 control1, Vector3 control2, Vector3 end, float t ) | Returns the derivative at the given name on the Bezier curve defined by this vector and the given name , name , and name points. |
Vector3 | DirectionTo ( Vector3 to ) | Returns the normalized vector pointing from this vector to name . |
float | DistanceSquaredTo ( Vector3 to ) | Returns the squared distance between this vector and name . This method runs faster than DistanceTo , so prefer it if you need to compare vectors or need the squared distance for some formula. |
float | DistanceTo ( Vector3 to ) | Returns the distance between this vector and name . |
float | Dot ( Vector3 with ) | Returns the dot product of this vector and name . |
Vector3 | Floor ( ) | Returns a new vector with all components rounded down (towards negative infinity). |
Vector3 | Inverse ( ) | Returns the inverse of this vector. This is the same as new Vector3(1 / v.X, 1 / v.Y, 1 / v.Z) . |
bool | IsFinite ( ) | Returns true if this vector is finite, by calling Mathf.IsFinite(real_t) on each component. |
bool | IsNormalized ( ) | Returns true if the vector is normalized, and false otherwise. |
float | Length ( ) | Returns the length (magnitude) of this vector. |
float | LengthSquared ( ) | Returns the squared length (squared magnitude) of this vector. This method runs faster than Length , so prefer it if you need to compare vectors or need the squared length for some formula. |
Vector3 | Lerp ( Vector3 to, float weight ) | Returns the result of the linear interpolation between this vector and name by amount name . |
Vector3 | LimitLength ( float length ) | Returns the vector with a maximum length by limiting its length to name . |
Vector3 | Max ( Vector3 with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector3(Mathf.Max(X, with.X), Mathf.Max(Y, with.Y), Mathf.Max(Z, with.Z)) . |
Vector3 | Max ( float with ) | Returns the result of the component-wise maximum between this vector and name . Equivalent to new Vector3(Mathf.Max(X, with), Mathf.Max(Y, with), Mathf.Max(Z, with)) . |
Vector3 | Min ( Vector3 with ) | Returns the result of the component-wise minimum between this vector and name . Equivalent to new Vector3(Mathf.Min(X, with.X), Mathf.Min(Y, with.Y), Mathf.Min(Z, with.Z)) . |
Axis | MaxAxisIndex ( ) | Returns the axis of the vector's highest value. See Axis . If all components are equal, this method returns Axis.X . |
Axis | MinAxisIndex ( ) | Returns the axis of the vector's lowest value. See Axis . If all components are equal, this method returns Axis.Z . |
Vector3 | MoveToward ( Vector3 to, float delta ) | Moves this vector toward name by the fixed name amount. |
Vector3 | Normalized ( ) | Returns the vector scaled to unit length. Equivalent to v / v.Length() . |
Basis | Outer ( Vector3 with ) | Returns the outer product with name . |
Vector3 | PosMod ( float mod ) | Returns a vector composed of the Mathf.PosMod(real_t, real_t) of this vector's components and name . |
Vector3 | PosMod ( Vector3 modv ) | Returns a vector composed of the Mathf.PosMod(real_t, real_t) of this vector's components and name 's components. |
Vector3 | Project ( Vector3 onNormal ) | Returns a new vector resulting from projecting this vector onto the given vector name . The resulting new vector is parallel to name . See also Slide . Note: If the vector name is a zero vector, the components of the resulting new vector will be real_t.NaN . |
Vector3 | Reflect ( Vector3 normal ) | Returns this vector reflected from a plane defined by the given name . |
Vector3 | Rotated ( Vector3 axis, float angle ) | Rotates this vector around a given name vector by name (in radians). The name vector must be a normalized vector. |
Vector3 | Round ( ) | Returns this vector with all components rounded to the nearest integer, with halfway cases rounded towards the nearest multiple of two. |
Vector3 | Sign ( ) | Returns a vector with each component set to one or negative one, depending on the signs of this vector's components, or zero if the component is zero, by calling Mathf.Sign(real_t) on each component. |
float | SignedAngleTo ( Vector3 to, Vector3 axis ) | Returns the signed angle to the given vector, in radians. The sign of the angle is positive in a counter-clockwise direction and negative in a clockwise direction when viewed from the side specified by the name . |
Vector3 | Slerp ( Vector3 to, float weight ) | Returns the result of the spherical linear interpolation between this vector and name by amount name . This method also handles interpolating the lengths if the input vectors have different lengths. For the special case of one or both input vectors having zero length, this method behaves like Lerp . |
Vector3 | Slide ( Vector3 normal ) | Returns a new vector resulting from sliding this vector along a plane with normal name . The resulting new vector is perpendicular to name , and is equivalent to this vector minus its projection on name . See also Project . Note: The vector name must be normalized. See also Normalized . |
Vector3 | Snapped ( Vector3 step ) | Returns a new vector with each component snapped to the nearest multiple of the corresponding component in name . This can also be used to round to an arbitrary number of decimals. |
Vector3 | Snapped ( float step ) | Returns a new vector with each component snapped to the nearest multiple of name . This can also be used to round to an arbitrary number of decimals. |
bool | Equals ( object? obj ) | Returns true if the vector is exactly equal to the given object ( name ). Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | Equals ( Vector3 other ) | Returns true if the vectors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | IsEqualApprox ( Vector3 other ) | Returns true if this vector and name are approximately equal, by running Mathf.IsEqualApprox(real_t, real_t) on each component. |
bool | IsZeroApprox ( ) | Returns true if this vector's values are approximately zero, by running Mathf.IsZeroApprox(real_t) on each component. This method is faster than using IsEqualApprox with one value as a zero vector. |
int | GetHashCode ( ) | Serves as the hash function for Vector3 . |
string | ToString ( ) | Converts this Vector3 to a string. |
string | ToString ( string? format ) | Converts this Vector3 to a string with the given name . |
Constants
Name | Type | Description | Initializer |
---|---|---|---|
Zero | Vector3 | Zero vector, a vector with all components set to 0 . Equivalent to new Vector3(0, 0, 0) . | new(0, 0, 0) |
One | Vector3 | One vector, a vector with all components set to 1 . Equivalent to new Vector3(1, 1, 1) . | new(1, 1, 1) |
Inf | Vector3 | Infinity vector, a vector with all components set to Mathf.Inf . Equivalent to new Vector3(Mathf.Inf, Mathf.Inf, Mathf.Inf) . | new(Mathf.Inf, Mathf.Inf, Mathf.Inf) |
Up | Vector3 | Up unit vector. Equivalent to new Vector3(0, 1, 0) . | new(0, 1, 0) |
Down | Vector3 | Down unit vector. Equivalent to new Vector3(0, -1, 0) . | new(0, -1, 0) |
Right | Vector3 | Right unit vector. Represents the local direction of right, and the global direction of east. Equivalent to new Vector3(1, 0, 0) . | new(-1, 0, 0) |
Left | Vector3 | Left unit vector. Represents the local direction of left, and the global direction of west. Equivalent to new Vector3(-1, 0, 0) . | new(1, 0, 0) |
Forward | Vector3 | Forward unit vector. Represents the local direction of forward, and the global direction of north. Equivalent to new Vector3(0, 0, -1) . | new(0, 0, 1) |
Back | Vector3 | Back unit vector. Represents the local direction of back, and the global direction of south. Equivalent to new Vector3(0, 0, 1) . | new(0, 0, -1) |
ModelLeft | Vector3 | Unit vector pointing towards the left side of imported 3D assets. | new(1, 0, 0) |
ModelRight | Vector3 | Unit vector pointing towards the right side of imported 3D assets. | new(-1, 0, 0) |
ModelTop | Vector3 | Unit vector pointing towards the top side (up) of imported 3D assets. | new(0, 1, 0) |
ModelBottom | Vector3 | Unit vector pointing towards the bottom side (down) of imported 3D assets. | new(0, -1, 0) |
ModelFront | Vector3 | Unit vector pointing towards the front side (facing forward) of imported 3D assets. | new(0, 0, 1) |
ModelRear | Vector3 | Unit vector pointing towards the rear side (back) of imported 3D assets. | new(0, 0, -1) |
Operators
Return Type | Signature | Description |
---|---|---|
Vector3 | + ( Vector3 left, Vector3 right ) | Adds each component of the Vector3 with the components of the given Vector3 . |
Vector3 | - ( Vector3 left, Vector3 right ) | Subtracts each component of the Vector3 by the components of the given Vector3 . |
Vector3 | - ( Vector3 vec ) | Returns the negative value of the Vector3 . This is the same as writing new Vector3(-v.X, -v.Y, -v.Z) . This operation flips the direction of the vector while keeping the same magnitude. With floats, the number zero can be either positive or negative. |
Vector3 | * ( Vector3 vec, float scale ) | Multiplies each component of the Vector3 by the given real_t . |
Vector3 | * ( float scale, Vector3 vec ) | Multiplies each component of the Vector3 by the given real_t . |
Vector3 | * ( Vector3 left, Vector3 right ) | Multiplies each component of the Vector3 by the components of the given Vector3 . |
Vector3 | / ( Vector3 vec, float divisor ) | Divides each component of the Vector3 by the given real_t . |
Vector3 | / ( Vector3 vec, Vector3 divisorv ) | Divides each component of the Vector3 by the components of the given Vector3 . |
Vector3 | % ( Vector3 vec, float divisor ) | Gets the remainder of each component of the Vector3 with the components of the given real_t . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using PosMod instead if you want to handle negative numbers. |
Vector3 | % ( Vector3 vec, Vector3 divisorv ) | Gets the remainder of each component of the Vector3 with the components of the given Vector3 . This operation uses truncated division, which is often not desired as it does not work well with negative numbers. Consider using PosMod instead if you want to handle negative numbers. |
bool | == ( Vector3 left, Vector3 right ) | Returns true if the vectors are exactly equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | != ( Vector3 left, Vector3 right ) | Returns true if the vectors are not equal. Note: Due to floating-point precision errors, consider using IsEqualApprox instead, which is more reliable. |
bool | < ( Vector3 left, Vector3 right ) | Compares two Vector3 vectors by first checking if the X value of the name vector is less than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. |
bool | > ( Vector3 left, Vector3 right ) | Compares two Vector3 vectors by first checking if the X value of the name vector is greater than the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. |
bool | <= ( Vector3 left, Vector3 right ) | Compares two Vector3 vectors by first checking if the X value of the name vector is less than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. |
bool | >= ( Vector3 left, Vector3 right ) | Compares two Vector3 vectors by first checking if the X value of the name vector is greater than or equal to the X value of the name vector. If the X values are exactly equal, then it repeats this check with the Y values of the two vectors, and then with the Z values. This operator is useful for sorting vectors. |
Node
package
Description
Classes
Node
class in Node
Properties
Name | Type | Access | Description |
---|---|---|---|
Name | string | get | |
Alive | bool | get | |
GlobalPosition | Vector3 | get | |
LocalPosition | Vector3 | get / set | |
LocalRotation | Quaternion | get / set | |
Valid | bool | get | |
Parent | Node | get | |
GlobalRotation | Quaternion | get | |
Tag | string | get / set |
Methods
Return Type | Signature | Description |
---|---|---|
RigidBody? | AsRigidBody ( ) | |
void | Destroy ( ) | |
void | SendHierarchical ( RoutingStrategy routing, object payload ) | Sends a hierarchical script message with the given payload. |
void | SubscribeTo <T > ( ) | |
Node? | FindColliderInChildren ( ) | |
T | AddScript <T > ( ) | |
T ? | FindScript <T > ( ) | |
bool | TagIs ( string tag ) |
RoutingStrategy
enum in Node
Properties
Property | Description |
---|---|
Up | An message will be passed to the specified root node and then to every node up in the hierarchy. |
Down | An message will be passed to every node down the tree in the hierarchy. |
Physics
package
Description
Classes
FeatureId
struct in Physics
Description
Shape-dependent identifier.
Fields
Name | Type | Description |
---|---|---|
Kind | FeatureKind | |
Id | int |
FeatureKind
enum in Physics
Properties
Property | Description |
---|---|
Vertex | Shape-dependent identifier of a vertex. |
Edge | Shape-dependent identifier of an edge. |
Face | Shape-dependent identifier of a face. |
Unknown | Unknown identifier. |
InteractionGroups
struct in Physics
Fields
Name | Type | Description |
---|---|---|
Memberships | int | Groups memberships. |
Filter | int | Groups filter. |
Intersection
struct in Physics
Description
A ray intersection result.
Fields
Name | Type | Description |
---|---|---|
Collider | Node | A handle of the collider with which intersection was detected. |
Normal | Vector3 | A normal at the intersection position. |
Position | Vector3 | A position of the intersection in world coordinates. |
Feature | FeatureId | Additional data that contains a kind of the feature with which intersection was detected as well as its index. Important notes.FeatureId::Face might have index that is greater than amount of triangles in a triangle mesh, this means that intersection was detected from “back” side of a face. To “fix” that index, simply subtract amount of triangles of a triangle mesh from the value. |
Toi | float | Distance from the ray origin. |
Physics
class in Physics
Constants
Name | Type | Value | Description |
---|---|---|---|
ExcludeFixed | int | 1 << 1 | Exclude from the query any collider attached to a fixed rigid-body and colliders with no rigid-body attached. |
ExcludeKinematic | int | 1 << 2 | Exclude from the query any collider attached to a kinematic rigid-body. |
ExcludeDynamic | int | 1 << 3 | Exclude from the query any collider attached to a dynamic rigid-body. |
ExcludeSensors | int | 1 << 4 | Exclude from the query any collider that is a sensor. |
ExcludeSolids | int | 1 << 5 | Exclude from the query any collider that is not a sensor. |
OnlyDynamic | int | LitePhysics :: EXCLUDE_FIXED | LitePhysics :: EXCLUDE_KINEMATIC |
OnlyKinematic | int | LitePhysics :: EXCLUDE_DYNAMIC | LitePhysics :: EXCLUDE_FIXED |
OnlyFixed | int | LitePhysics :: EXCLUDE_DYNAMIC | LitePhysics :: EXCLUDE_KINEMATIC |
Static Methods
Return Type | Signature | Description |
---|---|---|
List< Intersection > | CastRay ( RayCastOptions opts ) |
RayCastOptions
struct in Physics
Fields
Name | Type | Description |
---|---|---|
RayOrigin | Vector3 | A ray origin. |
RayDirection | Vector3 | A ray direction. Can be non-normalized. |
MaxLen | float | Maximum distance of cast. |
Groups | InteractionGroups? | Groups to check. |
SortResults | bool | Whether to sort intersections from closest to farthest. |
RigidBody
class in Physics
Methods
Return Type | Signature | Description |
---|---|---|
void | ApplyForce ( Vector3 force ) |
Prefab
package
Description
Classes
Prefab
class in Prefab
Methods
Return Type | Signature | Description |
---|---|---|
Node | InstantiateAt ( Vector3 position, Quaternion orientation ) |
Scene
package
Description
Classes
Scene
class in Scene
Static Methods
Return Type | Signature | Description |
---|---|---|
void | LoadAsync ( string scenePath ) |
Script
package
Description
Classes
GlobalScript
class in Script
Static Methods
Return Type | Signature | Description |
---|---|---|
T | Get <T > ( ) | find a global script by type |
NodeScript
class in Script
Properties
Name | Type | Access | Description |
---|---|---|---|
Node | ref Node | get |
UI
package
Description
Classes
Brush
struct in UI
Description
Brush defines a way to fill an arbitrary surface.
Fields
Name | Type | Description |
---|---|---|
SolidColor | Color? | A brush, that fills a surface with a solid color. |
LinearGradient | LinearGradient? | A brush, that fills a surface with a linear gradient, which is defined by two points in local coordinates and a set of stop points. See [ |
RadialGradient | RadialGradient? | A brush, that fills a surface with a radial gradient, which is defined by a center point in local coordinates and a set of stop points. See [ |
GradientPoint
struct in UI
Fields
Name | Type | Description |
---|---|---|
Stop | float | A distance from an origin of the gradient. |
Color | Color | Color of the point. |
LinearGradient
struct in UI
Fields
Name | Type | Description |
---|---|---|
From | Vector2 | Beginning of the gradient in local coordinates. |
To | Vector2 | End of the gradient in local coordinates. |
Stops | List< GradientPoint > | Stops of the gradient. |
RadialGradient
struct in UI
Fields
Name | Type | Description |
---|---|---|
Center | Vector2 | Center of the gradient in local coordinates. |
Stops | List< GradientPoint > | Stops of the gradient. |
Text
class in UI
Description
Text is a simple widget that allows you to print text on screen. It has various options like word wrapping, text alignment, and so on.
Properties
Name | Type | Access | Description |
---|---|---|---|
TextAsync | string | set | sets the text of UI element. applied at the end of frame. |
Static Methods
Return Type | Signature | Description |
---|---|---|
Text | New ( TextBuilder state ) |
TextBuilder
struct in UI
Fields
Name | Type | Description |
---|---|---|
Foreground | Brush? | |
FontSize | float? |
UiNode
class in UI
Window
package
Description
Classes
CursorGrabMode
enum in Window
Properties
Property | Description |
---|---|
None | No grabbing of the cursor is performed. |
Confined | The cursor is confined to the window area. There’s no guarantee that the cursor will be hidden. You should hide it by yourself if you want to do so. Platform-specific
|
Locked | The cursor is locked inside the window area to the certain position. There’s no guarantee that the cursor will be hidden. You should hide it by yourself if you want to do so. Platform-specific
|
Window
class in Window
Static Properties
Name | Type | Access | Description |
---|---|---|---|
CursorGrab | CursorGrabMode | set |