-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add flip convenience method to transform #14908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice idea! Some comments:
- The API looks a lot as if
dir
was the mirroring axis, i.e. "flip around this axis". But that's not quite true,dir
simply says which coordinate vectors to flip. This probably a naming issue, and I unfortunately don't have an immediate solution in mind. - Looking at
rotate_axis
, we probably should also offerflip_y
,flip_x
, andflip_z
as convenience. - If this API accepted
Vec3
we could do the following call, which reads kinda neatly:
transform.flip(Vec3::Z + Vec3::X);
Lastly, I don't think this fixes #4930, as this does address the hierarchy aspect. Flipping a sprite by Vec3::Y
will still break all existing Z
offsets on descendants.
@NthTensor @mweatherley maybe you or some other mathy people can chime in on whether my naming worry regarding the mirroring axis is justified. |
Darn i did not consider that just inverting the scale would not be enough to get this to work. Unfortunate. For my use case in animation these would probably work fine despite that. I will unmark this as fixing that, and make all the other good suggested adjustments |
Yeah, I think that's reasonable. I think that taking |
I like this but I am now thinking that just |
@Lubba-64 completely valid :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this API much more.
I don't think this needs to be built in in Bevy. they are convenience but very niche, and taking the name only it's not obvious what they do. just inverting the scale is simple enough and what most people will try anyway without looking for dedicated functions in my opinion |
Yeah, I haven't been following this but I of agree. It looks like this was originally a different change which was cut down, and while it is mergeable it doesn't really seem justified. I do appreciate you working on this, can you explain what you are going for here? |
(Not OP, but I've been following along) |
I think based on the discussion I need to revisit my implementation and close this PR as it does indeed not solve the target issue. |
Objective
Solution
flip_x
,flip_y
andflip_z
toTransform
Testing