:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the SkeletonModification2DLookAt.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_SkeletonModification2DLookAt: SkeletonModification2DLookAt ============================ **Inherits:** :ref:`SkeletonModification2D` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` A modification that rotates a :ref:`Bone2D` node to look at a target. Description ----------- This :ref:`SkeletonModification2D` rotates a bone to look a target. This is extremely helpful for moving character's head to look at the player, rotating a turret to look at a target, or any other case where you want to make a bone rotate towards something quickly and easily. Properties ---------- +---------------------------------+-------------------------------------------------------------------------------------+------------------+ | :ref:`NodePath` | :ref:`bone2d_node` | ``NodePath("")`` | +---------------------------------+-------------------------------------------------------------------------------------+------------------+ | :ref:`int` | :ref:`bone_index` | ``-1`` | +---------------------------------+-------------------------------------------------------------------------------------+------------------+ | :ref:`NodePath` | :ref:`target_nodepath` | ``NodePath("")`` | +---------------------------------+-------------------------------------------------------------------------------------+------------------+ Methods ------- +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_additional_rotation` **(** **)** |const| | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_constraint_angle_invert` **(** **)** |const| | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_constraint_angle_max` **(** **)** |const| | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_constraint_angle_min` **(** **)** |const| | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`get_enable_constraint` **(** **)** |const| | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_additional_rotation` **(** :ref:`float` rotation **)** | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_constraint_angle_invert` **(** :ref:`bool` invert **)** | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_constraint_angle_max` **(** :ref:`float` angle_max **)** | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_constraint_angle_min` **(** :ref:`float` angle_min **)** | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_enable_constraint` **(** :ref:`bool` enable_constraint **)** | +---------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------+ Property Descriptions --------------------- .. _class_SkeletonModification2DLookAt_property_bone2d_node: - :ref:`NodePath` **bone2d_node** +-----------+------------------------+ | *Default* | ``NodePath("")`` | +-----------+------------------------+ | *Setter* | set_bone2d_node(value) | +-----------+------------------------+ | *Getter* | get_bone2d_node() | +-----------+------------------------+ The :ref:`Bone2D` node that the modification will operate on. ---- .. _class_SkeletonModification2DLookAt_property_bone_index: - :ref:`int` **bone_index** +-----------+-----------------------+ | *Default* | ``-1`` | +-----------+-----------------------+ | *Setter* | set_bone_index(value) | +-----------+-----------------------+ | *Getter* | get_bone_index() | +-----------+-----------------------+ The index of the :ref:`Bone2D` node that the modification will oeprate on. ---- .. _class_SkeletonModification2DLookAt_property_target_nodepath: - :ref:`NodePath` **target_nodepath** +-----------+------------------------+ | *Default* | ``NodePath("")`` | +-----------+------------------------+ | *Setter* | set_target_node(value) | +-----------+------------------------+ | *Getter* | get_target_node() | +-----------+------------------------+ The NodePath to the node that is the target for the LookAt modification. This node is what the modification will rotate the :ref:`Bone2D` to. Method Descriptions ------------------- .. _class_SkeletonModification2DLookAt_method_get_additional_rotation: - :ref:`float` **get_additional_rotation** **(** **)** |const| Returns the amount of additional rotation that is applied after the LookAt modification executes. ---- .. _class_SkeletonModification2DLookAt_method_get_constraint_angle_invert: - :ref:`bool` **get_constraint_angle_invert** **(** **)** |const| Returns whether the constraints to this modification are inverted or not. ---- .. _class_SkeletonModification2DLookAt_method_get_constraint_angle_max: - :ref:`float` **get_constraint_angle_max** **(** **)** |const| Returns the constraint's maximum allowed angle. ---- .. _class_SkeletonModification2DLookAt_method_get_constraint_angle_min: - :ref:`float` **get_constraint_angle_min** **(** **)** |const| Returns the constraint's minimum allowed angle. ---- .. _class_SkeletonModification2DLookAt_method_get_enable_constraint: - :ref:`bool` **get_enable_constraint** **(** **)** |const| Returns ``true`` if the LookAt modification is using constraints. ---- .. _class_SkeletonModification2DLookAt_method_set_additional_rotation: - void **set_additional_rotation** **(** :ref:`float` rotation **)** Sets the amount of additional rotation that is to be applied after executing the modification. This allows for offsetting the results by the inputted rotation amount. ---- .. _class_SkeletonModification2DLookAt_method_set_constraint_angle_invert: - void **set_constraint_angle_invert** **(** :ref:`bool` invert **)** When ``true``, the modification will use an inverted joint constraint. An inverted joint constraint only constraints the :ref:`Bone2D` to the angles *outside of* the inputted minimum and maximum angles. For this reason, it is referred to as an inverted joint constraint, as it constraints the joint to the outside of the inputted values. ---- .. _class_SkeletonModification2DLookAt_method_set_constraint_angle_max: - void **set_constraint_angle_max** **(** :ref:`float` angle_max **)** Sets the constraint's maximum allowed angle. ---- .. _class_SkeletonModification2DLookAt_method_set_constraint_angle_min: - void **set_constraint_angle_min** **(** :ref:`float` angle_min **)** Sets the constraint's minimum allowed angle. ---- .. _class_SkeletonModification2DLookAt_method_set_enable_constraint: - void **set_enable_constraint** **(** :ref:`bool` enable_constraint **)** Sets whether this modification will use constraints or not. When ``true``, constraints will be applied when solving the LookAt modification. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`