[go: up one dir, main page]

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

In the matter catmod, copies sink into ground if their textures' rotation axis does not match their center of mass #9

Open
returnworld opened this issue Nov 12, 2024 · 2 comments
Labels
🙌 help wanted Extra attention is needed scope:catmods Issues of specific ct.js modules bundled with ct.js. type:enhancement A request to improve the existing functionality

Comments

@returnworld
Copy link

Describe the bug
isn't calculating the position of the collider correctly? I'm not sure.

To Reproduce
I've prepared a sample:
physics.zip

Expected behavior
some circle colliders fall through the textures

System information report
Ct.js v5.2.1 😽 (packaged)

NW.JS v0.72.0
Chromium v109.0.5414.87
Node.js v19.3.0
Pixi.js v7.3.2

WebGL available
WebGL vendor Google Inc. (NVIDIA)
WebGL renderer ANGLE (NVIDIA, NVIDIA GeForce GTX 1650 SUPER Direct3D11 vs_5_0 ps_5_0, D3D11)
OS win32 x64 // Windows_NT 10.0.19045

Screenshots (recommended)
image
image
notice that smiley in the center, it falls upside down as if its collider is offset.

@returnworld
Copy link
Author

I think this behavior is caused by me shifting the center of rotation of the axis.
I don't know why, but it doesn't show up on other similar sprites.
image
Managed to get this example to work with these settings.
But still I think either ide does not recalculate the coordinates of the collider correctly, or the information with the change of the axis center is not saved correctly for simulation, probably as in the problem with opacity.

@CosmoMyzrailGorynych CosmoMyzrailGorynych added the 🙌 help wanted Extra attention is needed label Nov 14, 2024
@CosmoMyzrailGorynych
Copy link
Collaborator
CosmoMyzrailGorynych commented Nov 14, 2024

Matter.js counts the physical center of shape's mass as 0;0 point, and this cannot be changed for Matter.js, causing a difference in behavior when using place and matter as the latter ignores the set rotation axis. Thus ct.js adds a field to additionally shift the texture.

Also note that debug mode for the place catmod reflects behavior of that catmod only. matter behaves differently, and it doesn't have a debug mode.

One can fix this issue by making this field compute automatically in-game. This should be trivial for rectangles and circles but will require more work for polygonal shapes. The issue with the collision mask preview in the texture editor is a separate issue, and purely a visual one. You can create a separate issue about it.

@CosmoMyzrailGorynych CosmoMyzrailGorynych changed the title incorrect physics In the matter catmod, copies sunk into ground if their textures' rotation axis does not match their center of mass Nov 14, 2024
@CosmoMyzrailGorynych CosmoMyzrailGorynych changed the title In the matter catmod, copies sunk into ground if their textures' rotation axis does not match their center of mass In the matter catmod, copies sink into ground if their textures' rotation axis does not match their center of mass Nov 14, 2024
@CosmoMyzrailGorynych CosmoMyzrailGorynych transferred this issue from ct-js/ct-js-old Nov 17, 2024
@CosmoMyzrailGorynych CosmoMyzrailGorynych added type:enhancement A request to improve the existing functionality scope:catmods Issues of specific ct.js modules bundled with ct.js. labels Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🙌 help wanted Extra attention is needed scope:catmods Issues of specific ct.js modules bundled with ct.js. type:enhancement A request to improve the existing functionality
Projects
Status: Current release
Development

No branches or pull requests

2 participants