User Tools

Site Tools


en:tutorials:useparentspace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:tutorials:useparentspace [2019/06/12 08:38 (2 weeks ago)]
sausage
en:tutorials:useparentspace [2019/06/13 03:03 (13 days ago)] (current)
sausage Iarwain's changes.
Line 3: Line 3:
 If an object is a child of another object, the child can be positioned relatively within that parent'​s space. The property to use is ''​UseParentSpace''​. If an object is a child of another object, the child can be positioned relatively within that parent'​s space. The property to use is ''​UseParentSpace''​.
  
-Setting that to ''​true''​ or ''​both''​ means that the object can be positioned using the position range of **(-0.5, -0.5)** ​to **(0.5, 0.5)**.+Setting that to ''​true''​ or ''​both''​ means that the object can be positioned using coordinates relative ​to the parent'​s size.
  
 {{page>::​init_new_project&​nofooter&​noeditbutton}} {{page>::​init_new_project&​nofooter&​noeditbutton}}
Line 141: Line 141:
 Notice that the ''​TestPoint''​ children don't shift their position with the change of pivot on the ''​PanelA''​ parent. This is because ''​PanelA''​ is just being rendered from a different pivot, but the position space that the TestPoint children operate in is still the same. Notice that the ''​TestPoint''​ children don't shift their position with the change of pivot on the ''​PanelA''​ parent. This is because ''​PanelA''​ is just being rendered from a different pivot, but the position space that the TestPoint children operate in is still the same.
  
-Relative co-ordinates are not limited to the (-0.5, -0.5) to (0.5, 0.5) range. They can extend beyond this range to move relatively further away from their parent.+So for a parent whose Pivot is centered, ​the relative top/left and bottom right corners are at ''​(-0.5, -0.5)''​ and ''​(0.5, 0.5)'',​ which maps to ''​(-ParentSizeX/​2,​ -ParentSizeY/​2)''​ and ''​(ParentSizeX/​2,​ ParentSizeY/​2)''​ 
 + 
 +Respectively if the parent has a ''​top left''​ Pivot, then the relative corners are at ''​(0,​ 0)''​ and ''​(1,​ 1)'',​ which maps to ''​(0,​ 0)''​ and ''​(ParentSizeX,​ ParentSizeY)''​. 
 + 
 +Relative co-ordinates are not limited to the ranges above. They can extend beyond this range to move relatively further away from their parent.
  
 There are lots of applications for relative positioning. Relative screen sizes are handy for simple UI, screen savers, and games where the screen size and scale will vary. There are lots of applications for relative positioning. Relative screen sizes are handy for simple UI, screen savers, and games where the screen size and scale will vary.
en/tutorials/useparentspace.txt · Last modified: 2019/06/13 03:03 (13 days ago) by sausage