Path: blob/master/doc/classes/AnimationNodeBlendSpace2D.xml
10277 views
<?xml version="1.0" encoding="UTF-8" ?>1<class name="AnimationNodeBlendSpace2D" inherits="AnimationRootNode" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">2<brief_description>3A set of [AnimationRootNode]s placed on 2D coordinates, crossfading between the three adjacent ones. Used by [AnimationTree].4</brief_description>5<description>6A resource used by [AnimationNodeBlendTree].7[AnimationNodeBlendSpace2D] represents a virtual 2D space on which [AnimationRootNode]s are placed. Outputs the linear blend of the three adjacent animations using a [Vector2] weight. Adjacent in this context means the three [AnimationRootNode]s making up the triangle that contains the current value.8You can add vertices to the blend space with [method add_blend_point] and automatically triangulate it by setting [member auto_triangles] to [code]true[/code]. Otherwise, use [method add_triangle] and [method remove_triangle] to triangulate the blend space by hand.9</description>10<tutorials>11<link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link>12<link title="Third Person Shooter (TPS) Demo">https://godotengine.org/asset-library/asset/2710</link>13</tutorials>14<methods>15<method name="add_blend_point">16<return type="void" />17<param index="0" name="node" type="AnimationRootNode" />18<param index="1" name="pos" type="Vector2" />19<param index="2" name="at_index" type="int" default="-1" />20<description>21Adds a new point that represents a [param node] at the position set by [param pos]. You can insert it at a specific index using the [param at_index] argument. If you use the default value for [param at_index], the point is inserted at the end of the blend points array.22</description>23</method>24<method name="add_triangle">25<return type="void" />26<param index="0" name="x" type="int" />27<param index="1" name="y" type="int" />28<param index="2" name="z" type="int" />29<param index="3" name="at_index" type="int" default="-1" />30<description>31Creates a new triangle using three points [param x], [param y], and [param z]. Triangles can overlap. You can insert the triangle at a specific index using the [param at_index] argument. If you use the default value for [param at_index], the point is inserted at the end of the blend points array.32</description>33</method>34<method name="get_blend_point_count" qualifiers="const">35<return type="int" />36<description>37Returns the number of points in the blend space.38</description>39</method>40<method name="get_blend_point_node" qualifiers="const">41<return type="AnimationRootNode" />42<param index="0" name="point" type="int" />43<description>44Returns the [AnimationRootNode] referenced by the point at index [param point].45</description>46</method>47<method name="get_blend_point_position" qualifiers="const">48<return type="Vector2" />49<param index="0" name="point" type="int" />50<description>51Returns the position of the point at index [param point].52</description>53</method>54<method name="get_triangle_count" qualifiers="const">55<return type="int" />56<description>57Returns the number of triangles in the blend space.58</description>59</method>60<method name="get_triangle_point">61<return type="int" />62<param index="0" name="triangle" type="int" />63<param index="1" name="point" type="int" />64<description>65Returns the position of the point at index [param point] in the triangle of index [param triangle].66</description>67</method>68<method name="remove_blend_point">69<return type="void" />70<param index="0" name="point" type="int" />71<description>72Removes the point at index [param point] from the blend space.73</description>74</method>75<method name="remove_triangle">76<return type="void" />77<param index="0" name="triangle" type="int" />78<description>79Removes the triangle at index [param triangle] from the blend space.80</description>81</method>82<method name="set_blend_point_node">83<return type="void" />84<param index="0" name="point" type="int" />85<param index="1" name="node" type="AnimationRootNode" />86<description>87Changes the [AnimationNode] referenced by the point at index [param point].88</description>89</method>90<method name="set_blend_point_position">91<return type="void" />92<param index="0" name="point" type="int" />93<param index="1" name="pos" type="Vector2" />94<description>95Updates the position of the point at index [param point] in the blend space.96</description>97</method>98</methods>99<members>100<member name="auto_triangles" type="bool" setter="set_auto_triangles" getter="get_auto_triangles" default="true">101If [code]true[/code], the blend space is triangulated automatically. The mesh updates every time you add or remove points with [method add_blend_point] and [method remove_blend_point].102</member>103<member name="blend_mode" type="int" setter="set_blend_mode" getter="get_blend_mode" enum="AnimationNodeBlendSpace2D.BlendMode" default="0">104Controls the interpolation between animations.105</member>106<member name="max_space" type="Vector2" setter="set_max_space" getter="get_max_space" default="Vector2(1, 1)">107The blend space's X and Y axes' upper limit for the points' position. See [method add_blend_point].108</member>109<member name="min_space" type="Vector2" setter="set_min_space" getter="get_min_space" default="Vector2(-1, -1)">110The blend space's X and Y axes' lower limit for the points' position. See [method add_blend_point].111</member>112<member name="snap" type="Vector2" setter="set_snap" getter="get_snap" default="Vector2(0.1, 0.1)">113Position increment to snap to when moving a point.114</member>115<member name="sync" type="bool" setter="set_use_sync" getter="is_using_sync" default="false">116If [code]false[/code], the blended animations' frame are stopped when the blend value is [code]0[/code].117If [code]true[/code], forcing the blended animations to advance frame.118</member>119<member name="x_label" type="String" setter="set_x_label" getter="get_x_label" default=""x"">120Name of the blend space's X axis.121</member>122<member name="y_label" type="String" setter="set_y_label" getter="get_y_label" default=""y"">123Name of the blend space's Y axis.124</member>125</members>126<signals>127<signal name="triangles_updated">128<description>129Emitted every time the blend space's triangles are created, removed, or when one of their vertices changes position.130</description>131</signal>132</signals>133<constants>134<constant name="BLEND_MODE_INTERPOLATED" value="0" enum="BlendMode">135The interpolation between animations is linear.136</constant>137<constant name="BLEND_MODE_DISCRETE" value="1" enum="BlendMode">138The blend space plays the animation of the animation node which blending position is closest to. Useful for frame-by-frame 2D animations.139</constant>140<constant name="BLEND_MODE_DISCRETE_CARRY" value="2" enum="BlendMode">141Similar to [constant BLEND_MODE_DISCRETE], but starts the new animation at the last animation's playback position.142</constant>143</constants>144</class>145146147