Merge pull request #2812 from aws-lumberyard-dev/scripting/vector_direction_nodes

Added Get Direction Vector node for Vector2,3 and 4
This commit is contained in:
Luis Sempé
2021-08-04 10:49:05 -07:00
committed by GitHub
4 changed files with 275 additions and 1 deletions
@@ -2771,6 +2771,80 @@
<source>VECTOR2_CREATEONE_OUTPUT0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_NAME">
<source>VECTOR2_DIRECTIONTO_NAME</source>
<comment>Class/Bus: Vector2 Event/Method: DirectionTo</comment>
<translation type="unfinished">Get Direction Vector</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_TOOLTIP</source>
<translation>Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_CATEGORY">
<source>VECTOR2_DIRECTIONTO_CATEGORY</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUT_NAME">
<source>VECTOR2_DIRECTIONTO_OUT_NAME</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUT_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_OUT_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTOL_IN_NAME">
<source>VECTOR2_DIRECTIONTOL_IN_NAME</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_IN_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_IN_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUTPUT0_NAME">
<source>VECTOR2_DIRECTIONTO_OUTPUT0_NAME</source>
<comment>C++ Type: const Vector2</comment>
<translation type="unfinished">Direction</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_OUTPUT0_TOOLTIP</source>
<translation>The direction between To and From normalized and optionally scaled</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUTPUT1_NAME">
<source>VECTOR2_DIRECTIONTO_OUTPUT1_NAME</source>
<comment>C++ Type: float</comment>
<translation type="unfinished">Distance</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_OUTPUT1_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_OUTPUT1_TOOLTIP</source>
<translation>The distance between To and From</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM0_NAME">
<source>VECTOR2_DIRECTIONTO_PARAM0_NAME</source>
<comment>Simple Type: Vector2 C++ Type: Vector2*</comment>
<translation type="unfinished">From</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM0_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_PARAM0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM1_NAME">
<source>VECTOR2_DIRECTIONTO_PARAM1_NAME</source>
<comment>Simple Type: Vector2 C++ Type: Vector2*</comment>
<translation type="unfinished">To</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM1_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_PARAM1_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM2_NAME">
<source>VECTOR2_DIRECTIONTO_PARAM2_NAME</source>
<comment>Simple Type: Vector2 C++ Type: Vector2*</comment>
<translation type="unfinished">Scale</translation>
</message>
<message id="VECTOR2_DIRECTIONTO_PARAM2_TOOLTIP">
<source>VECTOR2_DIRECTIONTO_PARAM2_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR2_GETPROJECTED_NAME">
<source>VECTOR2_GETPROJECTED_NAME</source>
<comment>Class/Bus: Vector2 Event/Method: GetProjected</comment>
@@ -32262,6 +32336,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
<source>VECTOR4_GETRECIPROCAL_PARAM0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_NAME">
<source>VECTOR4_DIRECTIONTO_NAME</source>
<comment>Class/Bus: Vector4 Event/Method: DirectionTo</comment>
<translation type="unfinished">Get Direction Vector</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_TOOLTIP</source>
<translation>Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_CATEGORY">
<source>VECTOR4_DIRECTIONTO_CATEGORY</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUT_NAME">
<source>VECTOR4_DIRECTIONTO_OUT_NAME</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUT_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_OUT_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTOL_IN_NAME">
<source>VECTOR4_DIRECTIONTOL_IN_NAME</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_IN_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_IN_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUTPUT0_NAME">
<source>VECTOR4_DIRECTIONTO_OUTPUT0_NAME</source>
<comment>C++ Type: const Vector4</comment>
<translation type="unfinished">Direction</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_OUTPUT0_TOOLTIP</source>
<translation>The direction between To and From normalized and optionally scaled</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUTPUT1_NAME">
<source>VECTOR4_DIRECTIONTO_OUTPUT1_NAME</source>
<comment>C++ Type: float</comment>
<translation type="unfinished">Distance</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_OUTPUT1_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_OUTPUT1_TOOLTIP</source>
<translation>The distance between To and From</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM0_NAME">
<source>VECTOR4_DIRECTIONTO_PARAM0_NAME</source>
<comment>Simple Type: Vector4 C++ Type: Vector4*</comment>
<translation type="unfinished">From</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM0_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_PARAM0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM1_NAME">
<source>VECTOR4_DIRECTIONTO_PARAM1_NAME</source>
<comment>Simple Type: Vector4 C++ Type: Vector4*</comment>
<translation type="unfinished">To</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM1_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_PARAM1_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM2_NAME">
<source>VECTOR4_DIRECTIONTO_PARAM2_NAME</source>
<comment>Simple Type: Vector4 C++ Type: Vector4*</comment>
<translation type="unfinished">Scale</translation>
</message>
<message id="VECTOR4_DIRECTIONTO_PARAM2_TOOLTIP">
<source>VECTOR4_DIRECTIONTO_PARAM2_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR4_AXISX_NAME">
<source>VECTOR4_AXISX_NAME</source>
<comment>Class/Bus: Vector4 Event/Method: CreateAxisX</comment>
@@ -37469,6 +37617,80 @@ An Entity can be selected by using the pick button, or by dragging an Entity fro
<source>VECTOR3_GETRECIPROCAL_PARAM0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_NAME">
<source>VECTOR3_DIRECTIONTO_NAME</source>
<comment>Class/Bus: Vector3 Event/Method: DirectionTo</comment>
<translation type="unfinished">Get Direction Vector</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_TOOLTIP</source>
<translation>Returns a direction vector between two points and the distance between them, by default the direction will be normalized, it may be optionally scaled using the Scale parameter if different from 1.0</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_CATEGORY">
<source>VECTOR3_DIRECTIONTO_CATEGORY</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUT_NAME">
<source>VECTOR3_DIRECTIONTO_OUT_NAME</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUT_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_OUT_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTOL_IN_NAME">
<source>VECTOR3_DIRECTIONTOL_IN_NAME</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_IN_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_IN_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUTPUT0_NAME">
<source>VECTOR3_DIRECTIONTO_OUTPUT0_NAME</source>
<comment>C++ Type: const Vector3</comment>
<translation type="unfinished">Direction</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_OUTPUT0_TOOLTIP</source>
<translation>The direction between To and From normalized and optionally scaled</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUTPUT1_NAME">
<source>VECTOR3_DIRECTIONTO_OUTPUT1_NAME</source>
<comment>C++ Type: float</comment>
<translation type="unfinished">Distance</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_OUTPUT1_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_OUTPUT1_TOOLTIP</source>
<translation>The distance between To and From</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM0_NAME">
<source>VECTOR3_DIRECTIONTO_PARAM0_NAME</source>
<comment>Simple Type: Vector3 C++ Type: Vector3*</comment>
<translation type="unfinished">From</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM0_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_PARAM0_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM1_NAME">
<source>VECTOR3_DIRECTIONTO_PARAM1_NAME</source>
<comment>Simple Type: Vector3 C++ Type: Vector3*</comment>
<translation type="unfinished">To</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM1_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_PARAM1_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM2_NAME">
<source>VECTOR3_DIRECTIONTO_PARAM2_NAME</source>
<comment>Simple Type: Vector3 C++ Type: Vector3*</comment>
<translation type="unfinished">Scale</translation>
</message>
<message id="VECTOR3_DIRECTIONTO_PARAM2_TOOLTIP">
<source>VECTOR3_DIRECTIONTO_PARAM2_TOOLTIP</source>
<translation></translation>
</message>
<message id="VECTOR3_PROJECT_NAME">
<source>VECTOR3_PROJECT_NAME</source>
<comment>Class/Bus: Vector3 Event/Method: Project</comment>
@@ -243,6 +243,22 @@ namespace ScriptCanvas
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ToPerpendicular, k_categoryName, "{CC4DC102-8B50-4828-BA94-0586F34E0D37}", "returns the vector (-Source.y, Source.x), a 90 degree, positive rotation", "Source");
AZ_INLINE void DirectionToDefaults(Node& node)
{
SetDefaultValuesByIndex<0>::_(node, Data::Vector2Type());
SetDefaultValuesByIndex<1>::_(node, Data::Vector2Type());
SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.));
}
AZ_INLINE std::tuple<Vector2Type, NumberType> DirectionTo(const Vector2Type from, const Vector2Type to, NumberType optionalScale = 1.f)
{
Vector2Type r = to - from;
float length = r.NormalizeWithLength();
r.SetLength(optionalScale);
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{49A2D7F6-6CD3-420E-8A79-D46B00DB6CED}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
using Registrar = RegistrarGeneric <
AbsoluteNode
, AddNode
@@ -295,6 +311,7 @@ namespace ScriptCanvas
, SlerpNode
, SubtractNode
, ToPerpendicularNode
, DirectionToNode
> ;
}
@@ -329,6 +329,23 @@ namespace ScriptCanvas
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE(ZAxisCross, k_categoryName, "{29206E84-392C-412E-9DD5-781B2759260D}", "returns the vector cross product of Z-Axis X Source", "Source");
AZ_INLINE void DirectionToDefaults(Node& node)
{
SetDefaultValuesByIndex<0>::_(node, Data::Vector3Type());
SetDefaultValuesByIndex<1>::_(node, Data::Vector3Type());
SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.));
}
AZ_INLINE std::tuple<Vector3Type, NumberType> DirectionTo(const Vector3Type from, const Vector3Type to, NumberType optionalScale = 1.f)
{
Vector3Type r = to - from;
float length = r.NormalizeWithLength();
r.SetLength(optionalScale);
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{28FBD529-4C9A-4E34-B8A0-A13B5DB3C331}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
using Registrar = RegistrarGeneric <
AbsoluteNode
, AddNode
@@ -403,6 +420,7 @@ namespace ScriptCanvas
, SlerpNode
, SubtractNode
, DirectionToNode
#if ENABLE_EXTENDED_MATH_SUPPORT
, XAxisCrossNode
@@ -214,6 +214,22 @@ namespace ScriptCanvas
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_DEPRECATED(Subtract, k_categoryName, "{A5FA6465-9C39-4A44-BD7C-E8ECF9503E46}", "This node is deprecated, use Subtract (-), it provides contextual type and slots", "A", "B");
AZ_INLINE void DirectionToDefaults(Node& node)
{
SetDefaultValuesByIndex<0>::_(node, Data::Vector4Type());
SetDefaultValuesByIndex<1>::_(node, Data::Vector4Type());
SetDefaultValuesByIndex<2>::_(node, Data::NumberType(1.));
}
AZ_INLINE std::tuple<Vector4Type, NumberType> DirectionTo(const Vector4Type from, const Vector4Type to, NumberType optionalScale = 1.f)
{
Vector4Type r = to - from;
float length = r.NormalizeWithLength();
r.SetLength(optionalScale);
return std::make_tuple(r, length);
}
SCRIPT_CANVAS_GENERIC_FUNCTION_NODE_WITH_DEFAULTS(DirectionTo, DirectionToDefaults, k_categoryName, "{463762DE-E541-4AFE-80C2-FED1C5273319}", "Returns a direction vector between two points and the distance between them, by default the direction will be normalized, but it may be optionally scaled using the Scale parameter if different from 1.0", "From", "To", "Scale");
using Registrar = RegistrarGeneric <
AbsoluteNode,
AddNode,
@@ -260,7 +276,8 @@ namespace ScriptCanvas
#endif
ReciprocalNode,
SubtractNode
SubtractNode,
DirectionToNode
> ;
}