Skip to content
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

Composite.translate didn't move the bodies included #1281

Open
Zxilly opened this issue Feb 20, 2024 · 0 comments
Open

Composite.translate didn't move the bodies included #1281

Zxilly opened this issue Feb 20, 2024 · 0 comments

Comments

@Zxilly
Copy link

Zxilly commented Feb 20, 2024

Firstly, thank you for creating such a great library!

I'm using this library to make some small toys, part of which is creating collision volumes for some characters. I used the earcut library to cut the glyphs of the characters into triangles and later created them in Matter.js.
Because the font library and mater.js use different coordinate systems, I needed to move the entire font path Composite in the last step, which is where I noticed that Composite.translate didn't work. I then manually kept references to each body and manipulating the body's position directly seemed to work fine.

I'm wondering if this is a bug or if my understanding of the api is off? I read a portion of the source code and noticed that the results of allBodies are usually cached, could this be causing the issue?

You can find a reproduce at the following url. If you replace the operation on bodies with the commented Composite.translate, the final glyphs on the canvas won't move like expected.

https://github.com/Zxilly/animated-timeline/blob/fdd658ab348c56be89258ce989baa107ea704db9/src/render/text.ts#L206

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant