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

Child in physics compound body not rotated properly #8744

Closed
QuirkyCort opened this issue Aug 16, 2020 · 3 comments
Closed

Child in physics compound body not rotated properly #8744

QuirkyCort opened this issue Aug 16, 2020 · 3 comments
Assignees
Labels
Milestone

Comments

@QuirkyCort
Copy link

Repro

Screenshots
See Playground.

Desktop (please complete the following information):
NA.

Smartphone (please complete the following information):
NA.

Additional context
See forum post: https://forum.babylonjs.com/t/child-in-physics-compound-body-not-rotated-properly-under-ammo-js-and-oimo/13291

Note 1: Although the initial forum post states that cannon is working fine, it was found that cannon has the same problem when the rotation is not a multiple of 90 degrees. The playground was updated to demonstrate the problem on cannon.

Note 2: As mentioned in the forum, a suggested solution is to change physicsImposter.ts, line 613:

let size = boundingInfo.boundingBox.extendSizeWorld.scale(2);

…into…

let size = boundingInfo.boundingBox.extendSize.scale(2);

This has been tested on a local copy and confirmed to fix the problem on both cannon and ammo. Oimo's problem seem more severe (...mesh not rotated, impostor rotated incorrectly and does not match mesh) and is not fixed by the above, but is improved (...mesh still not rotated, but impostor correctly match mesh).

Note 3: While I would like to offer a PR. I did not setup build for a local copy of babylon. I tested the above by simply doing a search and replace on a minified local copy. Sorry.

@deltakosh
Copy link
Contributor

Pinging @RaananW

@deltakosh deltakosh added this to the 4.2 milestone Aug 17, 2020
@RaananW
Copy link
Member

RaananW commented Aug 19, 2020

A small side note - the extendSize will work well on compound meshes' children. The rest will require the extendSizeWorld. But I am looking into it.

@QuirkyCort
Copy link
Author

I see that getObjectExtendSize sets the rotationQuaternion to IDENTITY_QUATERNION before getting extendSizeWorld. If I'm not understanding this wrong, this means that if the mesh isn't a child, then extendSize and extendSizeWorld should be identical.

@RaananW RaananW added the in progress Someone is currently working on this issue label Aug 25, 2020
@RaananW RaananW closed this as completed Sep 2, 2020
@RaananW RaananW removed the in progress Someone is currently working on this issue label Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants