User Tools

Site Tools


behaviortrees:nodes:mecanimik

Mecanim IK

Talk about the node

Attributes

General

  • Node Type: The type of node this is.
  • Name: The name of the node, useful for labeling larger trees.
  • Repeat: Whether or not this node should repeat. Mecanim IK nodes always repeat.
  • Debug Break (for Debugging): When checked, if this node is started while running in the editor, playback will be paused.

Conditional

  • Weight (for Random): How likely this node is to be selected when in a random node.
  • Priority (for Sequencer/Selector): The priority of this node. The highest priority child will be run first.
  • Starting Priority (for Priority): The initial priority of this node when the Priority node first starts.
  • Running Priority (for Priority): The priority of this node while running, refreshed by the Priority node at a set rate.

Mecanim IK

  • IK Goal : The IK goal you are adjusting with this node. The options for the node will change dependent on what you have selected.
    • Look At: Eyes, head, and body look at
    • Left Foot: Foot placement
    • Right Foot: Foot placement
    • Left Hand: Hand placement
    • Right Hand: Hand placement

Mecanim IK (Look At)

  • Position Target: The position to look at.
  • Look At Weight: A multiplier for all of the other weights.
  • Eyes Weight: How much the eyes should aim at the target (0 = not at all, 1 = completely).
  • Head Weight: How much the head should aim at the target (0 = not at all, 1 = completely).
  • Body Weight: How much the body should aim at the target (0 = not at all, 1 = completely).
  • Clamp Weight: How much rotation to allow the look at (0 = full rotation, 1 = no rotation).
  • Max Turn Rate: The maximum turn rate when switching position targets, or when the node is stopped.

Mecanim IK (Foot/Hand)

  • Position Target: The position where the foot/hand should be placed.
  • Rotation Target: The rotation that the foot/hand should have.
  • Position Weight: How much to blend between the starting position and target position (0 = completely at start, 1 = completely at target).
  • Rotation Weight: How much to blend between the starting rotation and target rotation (0 = completely at start, 1 = completely at target).

Usage

Expressions

Many options on a behavior tree contain expression fields, which allow you to enter an expression instead of a constant value. For instance, an expression field for a target will often take the name of a Navigation Target, a Transform, a GameObject, or Vector3, and an expression allows you to use any of these.

Expression fields will highlight red if there is an error in the expression. For longer expressions it can be easier if you copy the field out into a larger editor.

See Expressions for more information.

Mecanim IK

Talk about normal usage

Pitfalls

Expressions

Variables are a very useful part of expressions, but are probably the number one pitfall for three reasons:

  • They are case sensitive
  • They are created on demand
  • They can be used when unassigned

This means if you misspell or incorrectly capitalize your variable, it will treat it as an unassigned new variable and not raise an error of any kind. Keeping your variables names short, concise, and easy to spell will keep this from being too much of a problem.

Another problem this can cause is if you intend to use a string but forget the quotes. If it is a multiple word string it will highlight red, which makes it easy to catch, but if it is a single word string it will be considered a variable instead.

behaviortrees/nodes/mecanimik.txt · Last modified: 2022/08/13 18:13 (external edit)