lookAt() does not account for negative scale values
What happened?
the method 'lookAt()' will not look at the correct target vector if the parent's scale is negative.
What do you expect?
lookAt() should check for the component's scale while calculating its angle.
How can we reproduce this?
No response
What steps should take to fix this?
No response
Do have an example of where the bug occurs?
No response
Relevant log output
Execute in a terminal and put output into the code block below
Output of: flutter doctor -v
Affected platforms
All
Other information
No response
Are you interested in working on a PR for this?
- [ ] I want to work on this
Can you try this branch (I haven't had time to try it yet):
dependency_overrides:
flame:
git:
url: https://github.com/flame-engine/flame.git
ref: fix/look-at-to-take-scale-into-consideration
path: packages/flame
https://github.com/user-attachments/assets/3f6c22af-3776-4a51-a978-7e0fda0295f3
scale: Vector2(-1, 1) lookAt DOES NOT work correctly. See video for example. scale: Vector2(1, -1) lookAt DOES NOT work correctly. See video for example. scale: Vector2(-1, -1) lookAt works correctly. scale: Vector2(1, 1) lookAt works correctly.
Aah right, of course that wouldn't work. I'll try to do it on a lower level. Haha, apparently not the first time I've looked into this:
Bahaha that's amazing.
@gnarhard could you try now? I just pushed to the branch (still untested from my side, too much multi-tasking 😬 ).
Same results
@gnarhard I just pushed again (did a silly mistake in the last commit), third time's the charm? 🤞
Still spazzin :/
Still spazzin :/
Curious, exactly the same? I'll write some tests for this tomorrow.
Yes, same. Sounds good!
@gnarhard are you using nativeAngle?
Yes.
Can you try if the jitter also happens without a nativeAngle?
I think I have to take that one into consideration somehow too.
Jitter is happening with or without nativeAngle.