You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
0.15 Migration Guide: Provide examples for creating Rect with logical values (missing logical_rect method on Node - also see PR 15163 and PR 16375)
#1920
Open
janriemer opened this issue
Dec 29, 2024
· 0 comments
From 0.14 -> 015 there are two changes that have led to my (toy) project being broken and I couldn't figure out for a while why it broke (⚠ I'm very new to GameDev and Bevy).
the first change, introduced in PR 16375, states that ComputedNode’s fields and methods now use physical coordinates, instead of logical coordinates and by multiplying the physical coordinates by the inverse_scale_factor will give the logical values.
the second change introduced in PR 15163, states that methods logical_rect and physical_rect have been removed from Node
IMHO, we should provide examples on how to reimplement logical_rect for oneself, if one decides that it is a useful method to have (I've done this now after migrating from 0.12. -> 0.15 by implementing an extension trait on Node).
Also both changes mentioned above should reference each other, because one change alone would probably have a small breaking impact, but in combination they have high potential for "invisibly" breaking apps (aka no compile errors, but wrong logic).
fnmy_system(q_nodes:Query<&Node,&ComputedNode,&GlobalTransform>){for(node, comp_node, g_trans)in&q_nodes {let logical_rect = Rect::from_center_size(// we convert both values to their logical values
g_trans.translation.xy()* comp_node.inverse_scale_factor(),
comp_node.size()* comp_node.inverse_scale_factor());}}
The text was updated successfully, but these errors were encountered:
janriemer
changed the title
0.15 Migration Guide: Provide examples for creating Rect with logical values (missing logical_rect method on Node (also see PR 15163 and PR 16375))
0.15 Migration Guide: Provide examples for creating Rect with logical values (missing logical_rect method on Node - also see PR 15163 and PR 16375)
Dec 29, 2024
Problem
From 0.14 -> 015 there are two changes that have led to my (toy) project being broken and I couldn't figure out for a while why it broke (⚠ I'm very new to GameDev and Bevy).
ComputedNode
’s fields and methods now use physical coordinates, instead of logical coordinates and by multiplying the physical coordinates by theinverse_scale_factor
will give the logical values.logical_rect
andphysical_rect
have been removed fromNode
IMHO, we should provide examples on how to reimplement
logical_rect
for oneself, if one decides that it is a useful method to have (I've done this now after migrating from 0.12. -> 0.15 by implementing an extension trait onNode
).Also both changes mentioned above should reference each other, because one change alone would probably have a small breaking impact, but in combination they have high potential for "invisibly" breaking apps (aka no compile errors, but wrong logic).
Proposed solution
An example that we should provide in migration guide for PR 15163, while referencing the other changes regarding
ComputedNode
:0.14:
0.15:
The text was updated successfully, but these errors were encountered: