Flutter API: get component bounds or path?
Hey there, I am using the new renderer with the flutter API for a game. I want to create bounds in my physics engine for some components. In the past I have always done this manually but I want to be able to animate them and have multiple bounds in the one artboard. Is there a way to do this? if not, please consider it a feature request!
my workaround at the moment is to create a 1px by 1px rect or circle and scale it up to the desired size. Then I create the bounds with this function (which assumes no other scaling in the component for now). Obviously not ideal but does the trick. would love a better way though.
Rect getRectFromComponentTransform(String name) {
final component = ab.component(name)!;
final transform = component.worldTransform;
return Rect.fromCenter(center: Offset(transform.translation.x,transform.translation.y),
width: component.scaleX,
height: component.scaleY,
);
}