| Attention | Topic was automatically imported from the old Question2Answer platform. | |
| Asked By | LightBWK | |
| Old Version | Published before Godot 3 was released. |
What are the pros and cons of using set_pos() compared to set_offset()?
| Attention | Topic was automatically imported from the old Question2Answer platform. | |
| Asked By | LightBWK | |
| Old Version | Published before Godot 3 was released. |
What are the pros and cons of using set_pos() compared to set_offset()?
| Reply From: | Vladislav Vorobiev |
set_pos() changes position of Node, set_offset() is defined for several nodes only and has its own result. Let’s read some documentation:
Sprite Node: set_offset(Vector2 offset)
Set the sprite draw offset, useful for setting rotation pivots.
Camera2D Node: set_offset(Vector2 offset)
Set the scroll offset. Useful for looking around or camera shake animations.
PathFollow2D Node: set_offset(float offset)
Sets the distance from the first vertex, measured in pixels along the path. This sets this node’s position to a point within the path.