9092858a58
I updated everything to the latest Unity Editor. Also realized I had the wrong shaders on my hairs, those are fixed and the hairs look MUCH better!
1.7 KiB
1.7 KiB
Rotate Node
Description
Rotates value of input UV around a reference point defined by input Center by the amount of input Rotation. The unit for rotation angle can be selected by the parameter Unit.
Ports
Name | Direction | Type | Binding | Description |
---|---|---|---|---|
UV | Input | Vector 2 | UV | Input UV value |
Center | Input | Vector 2 | None | Center point to rotate around |
Rotation | Input | Float | None | Amount of rotation to apply |
Out | Output | Vector 2 | None | Output UV value |
Controls
Name | Type | Options | Description |
---|---|---|---|
Unit | Dropdown | Radians, Degrees | Switches the unit for input Rotation |
Generated Code Example
The following example code represents one possible outcome of this node per Unit mode.
Radians
void Unity_Rotate_Radians_float(float2 UV, float2 Center, float Rotation, out float2 Out)
{
UV -= Center;
float s = sin(Rotation);
float c = cos(Rotation);
float2x2 rMatrix = float2x2(c, -s, s, c);
rMatrix *= 0.5;
rMatrix += 0.5;
rMatrix = rMatrix * 2 - 1;
UV.xy = mul(UV.xy, rMatrix);
UV += Center;
Out = UV;
}
Degrees
void Unity_Rotate_Degrees_float(float2 UV, float2 Center, float Rotation, out float2 Out)
{
Rotation = Rotation * (3.1415926f/180.0f);
UV -= Center;
float s = sin(Rotation);
float c = cos(Rotation);
float2x2 rMatrix = float2x2(c, -s, s, c);
rMatrix *= 0.5;
rMatrix += 0.5;
rMatrix = rMatrix * 2 - 1;
UV.xy = mul(UV.xy, rMatrix);
UV += Center;
Out = UV;
}