→Target: add info |
add needed info |
||
Line 3: | Line 3: | ||
{{Infobox Component | {{Infobox Component | ||
|Image=AxisAlignerComponent.png | |Image=AxisAlignerComponent.png | ||
|Name= | |Name=Axis Aligner | ||
}} | }} | ||
== | The '''AxisAligner''' component is used to Align elements along a single line axis in local space under a slot based on their Bounding boxes. It also allows for excluding bounded elements from calculations, and for aligning elements themselves so that they can be centered like varied sized beads on a string or like boxes into the corner edge between a wall and floor. These calculations are heavy, and this component is best used lightly. Remove this component after using it to Align world elements, as it will be constantly active and will behave violently if used to Align shelves for example in a world and left unremoved. | ||
== Fields == | |||
{{Table ComponentFields | {{Table ComponentFields | ||
|AutoAddChildren|Bool| Controls whether slots below this component's slot in the hierarchy are automatically added to <code>_targets</code> | |AutoAddChildren|Bool| Controls whether slots below this component's slot in the hierarchy are automatically added to <code>_targets</code> | ||
|AutoAddIgnoreTags|{{RootFieldType|SyncFieldList`1|[[Type:String|String]]}}|TypeAdv1=true| | |AutoAddIgnoreTags|{{RootFieldType|SyncFieldList`1|[[Type:String|String]]}}|TypeAdv1=true| if <code>AutoAddChildren</code> is enabled. A slot will not be added to <code>_targets</code> if it's tag is in this list. | ||
|Direction|'''[[#AxisDir|AxisDir]]'''|TypeAdv2=true| The axis and direction the items will be aligned on | |Direction|'''[[#AxisDir|AxisDir]]'''|TypeAdv2=true| The axis and direction the items will be aligned on | ||
|GlobalAxisXAlign|'''[[#Align|Align]]'''|TypeAdv3=true| Controls how items will be aligned globally, with each other in the X Axis | |GlobalAxisXAlign|'''[[#Align|Align]]'''|TypeAdv3=true| Controls how items will be aligned globally, with each other in the X Axis | ||
Line 17: | Line 19: | ||
|ElementAxisZAlign|'''[[#Align|Align]]'''|TypeAdv8=true| Controls how each item aligns itself, within the align, in the Z Axis | |ElementAxisZAlign|'''[[#Align|Align]]'''|TypeAdv8=true| Controls how each item aligns itself, within the align, in the Z Axis | ||
|Separation|Float| The spacing between each item in <code>_targets</code> along the specified axis | |Separation|Float| The spacing between each item in <code>_targets</code> along the specified axis | ||
|ExcludeList|{{RootFieldType|SyncRefList`1|[[Type:IBounded|IBounded]]}}|TypeAdv10=true| A list of slots which are excluded from the | |ExcludeList|{{RootFieldType|SyncRefList`1|[[Type:IBounded|IBounded]]}}|TypeAdv10=true| A list of Bounded elements under target slots which are excluded from the aligners bounds calculations | ||
|_targets|{{RootFieldType|SyncList`1|[[#Target|Target]]}}|TypeAdv11=true| A list of slots which will be aligned. This will be automatically generated if <code>AutoAddChildren</code> is enabled. | |_targets|{{RootFieldType|SyncList`1|[[#Target|Target]]}}|TypeAdv11=true| A list of slots which will be aligned. This will be automatically generated if <code>AutoAddChildren</code> is enabled. | ||
}} | }} | ||
Line 23: | Line 25: | ||
== Target == | == Target == | ||
{{Table TypeFields | {{Table TypeFields | ||
|TargetSlot|Slot| The slot to read bounds data from | |TargetSlot|Slot| The slot to read bounds data from. | ||
|PositionDrive|{{RootFieldType|FieldDrive`1|[[Type:Float3|Float3]]}}|TypeAdv1=true| The position of <code>TargetSlot</code> to drive in order to align it. | |PositionDrive|{{RootFieldType|FieldDrive`1|[[Type:Float3|Float3]]}}|TypeAdv1=true| The position of <code>TargetSlot</code> to drive in order to align it. | ||
}} | }} | ||
== Align == | == Align == | ||
Note: changing the alignment does not change the order of elements. Just how the bounding box for the elements is positioned relative to 0. Basically this acts as a translation alignment, rather than a reordering of elements. | |||
{{Table EnumValues | {{Table EnumValues | ||
|Neg|0| | |Neg|0| Align the elements on this axis starting at zero going towards the negative direction. | ||
|Mid|1| | |Mid|1| Align the elements on this axis so that the Bounded center ends up at 0 on this axis. | ||
|Pos|2| | |Pos|2| Align the elements on this axis starting at 0 going towards the positive direction. | ||
}} | }} | ||
Line 37: | Line 40: | ||
{{stub}} | {{stub}} | ||
{{Table EnumValues | {{Table EnumValues | ||
|Xpos|0| | |Xpos|0| Align elements in a line towards the positive X axis locally. | ||
|Xneg|1| | |Xneg|1| Align elements in a line towards the negative X axis locally. | ||
|Ypos|2| | |Ypos|2| Align elements in a line towards the positive Y axis locally. | ||
|Yneg|3| | |Yneg|3| Align elements in a line towards the negative Y axis locally. | ||
|Zpos|4| | |Zpos|4| Align elements in a line towards the positive Z axis locally. | ||
|Zneg|5| | |Zneg|5| Align elements in a line towards the negative Z axis locally. | ||
}} | }} | ||
Line 56: | Line 59: | ||
* [https://www.youtube.com/watch?v=NkjcGAwlZMs AxisAligner tutorial] by [[User:ProbablePrime|ProbablePrime]] | * [https://www.youtube.com/watch?v=NkjcGAwlZMs AxisAligner tutorial] by [[User:ProbablePrime|ProbablePrime]] | ||
== | == See Also == | ||
</translate> | </translate> | ||
[[Category:Components{{#translation:}}|Axis Aligner]] | [[Category:Components{{#translation:}}|Axis Aligner]] | ||
[[Category:Components With Nested Enums{{#translation:}}|Axis Aligner]] | [[Category:Components With Nested Enums{{#translation:}}|Axis Aligner]] | ||
[[Category:Components With Nested Types{{#translation:}}|Axis Aligner]] | [[Category:Components With Nested Types{{#translation:}}|Axis Aligner]] | ||
[[Category:Components:Transform:Drivers{{#translation:}}|Axis Aligner]] | [[Category:Components:Transform:Drivers{{#translation:}}|Axis Aligner]] |
Latest revision as of 18:35, 31 December 2024
The AxisAligner component is used to Align elements along a single line axis in local space under a slot based on their Bounding boxes. It also allows for excluding bounded elements from calculations, and for aligning elements themselves so that they can be centered like varied sized beads on a string or like boxes into the corner edge between a wall and floor. These calculations are heavy, and this component is best used lightly. Remove this component after using it to Align world elements, as it will be constantly active and will behave violently if used to Align shelves for example in a world and left unremoved.
Fields
Name | Type | Description |
---|---|---|
persistent
|
Bool | Determines whether or not this item will be saved to the server. |
UpdateOrder
|
Int | Controls the order in which this component is updated. |
Enabled
|
Bool | Controls whether or not this component is enabled. |
AutoAddChildren
|
Bool | Controls whether slots below this component's slot in the hierarchy are automatically added to _targets
|
AutoAddIgnoreTags
|
direct SyncFieldList`1<String> | if AutoAddChildren is enabled. A slot will not be added to _targets if it's tag is in this list.
|
Direction
|
AxisDir | The axis and direction the items will be aligned on |
GlobalAxisXAlign
|
Align | Controls how items will be aligned globally, with each other in the X Axis |
GlobalAxisYAlign
|
Align | Controls how items will be aligned globally, with each other in the Y Axis |
GlobalAxisZAlign
|
Align | Controls how items will be aligned globally, with each other in the Z Axis |
ElementAxisXAlign
|
Align | Controls how each item aligns itself, within the align, in the X Axis |
ElementAxisYAlign
|
Align | Controls how each item aligns itself, within the align, in the Y Axis |
ElementAxisZAlign
|
Align | Controls how each item aligns itself, within the align, in the Z Axis |
Separation
|
Float | The spacing between each item in _targets along the specified axis
|
ExcludeList
|
list of IBounded | A list of Bounded elements under target slots which are excluded from the aligners bounds calculations |
_targets
|
list of Target | A list of slots which will be aligned. This will be automatically generated if AutoAddChildren is enabled.
|
Target
Name | Type | Description |
---|---|---|
TargetSlot
|
Slot | The slot to read bounds data from. |
PositionDrive
|
field drive of Float3 | The position of TargetSlot to drive in order to align it.
|
Align
Note: changing the alignment does not change the order of elements. Just how the bounding box for the elements is positioned relative to 0. Basically this acts as a translation alignment, rather than a reordering of elements.
Name | Value | Description |
---|---|---|
Neg
|
0 | Align the elements on this axis starting at zero going towards the negative direction. |
Mid
|
1 | Align the elements on this axis so that the Bounded center ends up at 0 on this axis. |
Pos
|
2 | Align the elements on this axis starting at 0 going towards the positive direction. |
AxisDir
This article or section is a Stub. You can help the Resonite Wiki by expanding it.
Name | Value | Description |
---|---|---|
Xpos
|
0 | Align elements in a line towards the positive X axis locally. |
Xneg
|
1 | Align elements in a line towards the negative X axis locally. |
Ypos
|
2 | Align elements in a line towards the positive Y axis locally. |
Yneg
|
3 | Align elements in a line towards the negative Y axis locally. |
Zpos
|
4 | Align elements in a line towards the positive Z axis locally. |
Zneg
|
5 | Align elements in a line towards the negative Z axis locally. |
Disadvantages and Alternatives
As the Axis Aligner works off of Bounds Calculations, and runs its calculations under a wide range of criteria, it can quickly become heavy with a doezen slots or so. Its Bounds-based nature alao makes it unsuited for evenly spacing objects with different bounds.
To mitigate these kinds of issues, one can make their own version of this in Protoflux, by having OnChange or other triggers fire a ForLoop, which iterates through all Slot Children, and gives them an offset based on the Iteration multiplied by a Float3 for the position. To further implement the bounds functionality, one can use a value that increases by the bounds calculation every iteration, instead of a number based on the Iteration itself.
A simple example was used to align the Avatars in Avatar Station, and is available in Nuki's Public Folder.