-
-
Notifications
You must be signed in to change notification settings - Fork 947
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
[flame_forge2d] Body component still renders in original position when setting transform to Vector2(0, 0) #3489
Comments
That's curious, I thought When looking here: It seems like Ah, or is the whole situation described above happening in the same tick? |
No, what I described didn't happen in the same tick. Check out this video to see the problem(As you can see I called the transform_issue.mp4 |
You're absolutely correct! Do you want to provide a PR with the fix? |
@spydon Thank you for your quick response and for confirming my guess! To be honest, I'm not familiar with the code logic in this specific area, and I'm concerned that I might miss something important if I were to attempt a fix. Additionally, I'm currently focused on my personal project and have limited availability. Thank you again for your understanding. |
Alright, no problem, I'll do the fix myself tomorrow. :) |
What happened?
The
body_component
'ssetTransform
method appears to have a bug when called withVector2(0, 0)
. While the component'sposition
property is correctly updated toVector2(0, 0)
, the component is still rendered at its original position on the screen. This suggests a rendering issue where the visual representation of the component is not updating correctly despite the underlying position data being modified.What do you expect?
When
setTransform(Vector2(0, 0))
is called on aBodyComponent
, it should visually move and render atVector2(0, 0)
. The rendered position should reflect the updatedposition
property.How can we reproduce this?
BodyComponent
within aFlameGame
that is usingForge2DWorld
.BodyComponent
at a position other thanVector2(0, 0)
.setTransform(Vector2(0, 0))
on theBodyComponent
.component.position
that it is indeedVector2(0, 0)
.setTransform
position, and not at the originVector2(0, 0)
.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
[√] Flutter (Channel beta, 3.28.0-0.1.pre, on Microsoft Windows [版本 10.0.26100.2894], locale zh-CN)
[√] Windows Version (11 专业版 64-bit, 24H2, 2009)
[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
[√] Chrome - develop for the web
[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.10.1)
[√] Android Studio (version 2022.1)
[√] VS Code (version 1.97.1)
[√] Connected device (3 available)
! Device emulator-5562 is offline.
[√] Network resources
Affected platforms
All
Other information
Upon inspecting the source code, it is suspected that the issue might originate from the
renderTree
method within thebody_component
. Specifically, the conditional statement:appears to be problematic. It is observed that matrix.m14 and matrix.m24 are consistently 0.
I am not very familiar with Matrix4, so this analysis is purely based on observation and is just a guess. The issue seems to be resolved by modifying this condition to compare matrix.m41 and matrix.m42 instead
Are you interested in working on a PR for this?
The text was updated successfully, but these errors were encountered: