dimforge / dimforge/bevy_rapier

Colliders on Bevy meshes don't respect scale on initial tick

Open
#417 1 comment 0 reactions 0 assignees View on GitHub
A-Geometry A-Integration C-Bug D-Medium P-Medium S-not-started
Dominant language
Rust
Stars
1.6k
Forks
282
PR merge metrics
No merged PRs in 30d

Description

Happening on `bevy = 0.11` and `bevy_rapier3d = 0.22.0`

When I load a GLTF Scene that has a `scale` transform that downscales the scene and spawn Colliders for its meshes, the Colliders don't match the scale until the 2nd frame.

It seems like the Colliders are always double the size of the scaled mesh, no matter what `scale` I set, so long as it's `< 1.0`. For example, I tried spawning a scene with scale `0.005`, and the debug rendered colliders are double the mesh sizes (not the original `1.0` scale).

I was able to workaround the issue by simply running the system twice, and on the 2nd iteration, it auto fixes itself: https://github.com/spoorn/mangovillage/blob/3d/client/src/physics/mod.rs#L17

I thought maybe this was due to meshes taking a second to load, but I've tried putting time delays, tick delays (as in waiting 1000 frames before spawning the Colliders), checking if the assets are fully loaded, but the same problem always happens.

I have an MVP here: https://github.com/spoorn/mangovillage/blob/3d/mvp/src/main.rs if needed, clone the repo on branch `3d` and run `cargo run -p mvp`.

Screenshot:

![image](https://github.com/dimforge/bevy_rapier/assets/12925899/4ceab204-483e-4c78-9288-90a3cbb7936a)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.