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

Node with transform doesn't scale properly #141

Open
Jochem-W opened this issue Jan 7, 2022 · 2 comments
Open

Node with transform doesn't scale properly #141

Jochem-W opened this issue Jan 7, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@Jochem-W
Copy link

Jochem-W commented Jan 7, 2022

When I open a model (link) in the PlayCanvas Viewer that scales the root node along the X-axis by using the scale property it's displayed correctly:
image

When I modify the model (link) to use the matrix property instead of scale, the entire model is flipped along the vertical axis:
image

Both models validate without errors and are displayed correctly in almost every other viewer I tested (only Cesium had trouble with the normals, but this is a known issue).

@willeastcott
Copy link
Contributor

That model has a negative scale on the X axis.

So this is because the engine extracts scale from the matrix property using the Mat4#getScale function which only returns positive scales.

https://github.com/playcanvas/engine/blob/dev/src/resources/parser/glb-parser.js#L1457

Got any thoughts on this @mvaligursky or @slimbuck?

@mvaligursky
Copy link
Contributor

We might need to do what's suggested here:
https://pixel.engineer/posts/matrix-decomposition-unity/

an additional negativity check on the rotation matrix and flip both scale and rotation in some cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants