Blend spaces
- Game Development course
- Expert
- Lesson 28/47
- 4 min
Learn to blend motion with Blend2D and Blend3D.
What is Blend2D?
Blend2D is a node that blends animations with two dimensional input values. For example it moves between walking and running animations depending on the movement direction. The blend ratio is set with a Vector2 value.
agac.set("parameters/Blend2D/blend_position", Vector2(0.5, 0.0))This way movements look more natural.
Blend3D and blend space
Blend3D blends animations with three dimensional input. It is used for more complex movements. A blend space defines the blending area and computes weights based on the input value.
var karisim = Vector3(0.5, 0.0, 0.5)A blend space decides how animations are blended together.
Practice Set the blend value
In a script named BlendAyari, assign the $AnimationTree node to a variable named agac in _ready. Then set the blend value with agac.set("parameters/Blend2D/blend_position", Vector2(0.5, 0.0)) and print the text "Blend degeri ayarlandi" with print.
Starter code
extends Node
func _ready():
var agac = $AnimationTree
# "parameters/Blend2D/blend_position" yoluna Vector2(0.5, 0.0) degerini ata
# "Blend degeri ayarlandi" metnini yazdirSample solution
extends Node
func _ready():
var agac = $AnimationTree
agac.set("parameters/Blend2D/blend_position", Vector2(0.5, 0.0))
print("Blend degeri ayarlandi")Expected output
Blend degeri ayarlandi
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 What does the Blend2D node do?
- It blends animations with 2D input Correct answer
- It loops a single animation
- It queues animations
- It creates a state machine
Explanation: Blend2D blends two or more animations proportionally according to a Vector2 input.
2 Write the blend property
agac.set("parameters/Blend2D/____", Vector2(0.5, 0.0))
agac.set("parameters/Blend2D/blend_position", Vector2(0.5, 0.0))
Explanation: In the Blend2D node the property that sets the blend position is blend_position.
3 Blend terms
| Term | Meaning |
|---|---|
Blend2D |
Blending with 2D input |
Blend3D |
Blending with 3D input |
Blend space |
The area where blend ratios are defined |
Blend değeri |
Sets the blend ratio of animations |