Loss of determinism when using collider.setRotationWrtParent or rigidBody.setRotation
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 38/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- javascript, rust
- Lĩnh vực
- game-dev
Hướng nghiên cứu
Tái hiện vấn đề với @dimforge/rapier2d-compat 0.14.0 bằng cách khôi phục cùng một snapshot của World, sau đó áp dụng rigidBody.setRotation hoặc collider.setRotationWrtParent trước khi chạy các lần mô phỏng lặp lại. So sánh kết quả với trường hợp chỉ khôi phục snapshot và kiểm tra hành vi của các phương thức này cũng như World.restoreSnapshot. Được xem là hoàn tất khi kết quả giống hệt nhau giữa các lần chạy và hành vi nhất quán với restriction của collider đã được tài liệu hóa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have observed that the Rapier.js physics simulation loses determinism when using the collider.setRotationWrtParent and rigidBody.setRotation methods. Specifically, even when starting from the same initial state (restored via World.restoreSnapshot), the simulation outcomes differ every time these methods are applied. This behavior does not occur when only restoring the world snapshot without applying these methods.
Steps to Reproduce
- Restore the world from a snapshot:
const world = RAPIER.World.restoreSnapshot(base64ToUint8Array(worldData.world));
- Apply one of the following methods:
- For a rigid body:
const rigidBody = world.rigidBodies.get(rigidBodyHandle);
rigidBody.setRotation(0); // Breaks determinism
- For a collider:
const collider = world.colliders.get(colliderHandle);
collider.setRotationWrtParent(0); // also breaks determinism, even when the collider is already attached to a rigid body. This behavior contradicts the documentation, which states: "Does nothing if this collider isn't attached to a rigid-body." However, based on my observations, the method appears to have an effect even when the collider is attached, potentially introducing non-deterministic behavior.
- Run the simulation multiple times and observe that the results differ each time.
Expected Behavior
The simulation should produce identical results every time it is run from the same initial state, regardless of whether collider.setRotationWrtParent or rigidBody.setRotation is used.
Actual Behavior
When collider.setRotationWrtParent or rigidBody.setRotation is called, the simulation outcomes vary between runs, breaking determinism.
Environment
- Rapier.js version:
@dimforge/rapier2d-compat0.14.0 - Browser: Chrome 132.0.6834.162 (Official Build) (x86_64)
- Operating System: macOS
Additional Notes
It seems that these methods might introduce non-deterministic behavior due to floating-point precision issues or internal state changes that are not synchronized properly. This could be related to how the physics engine handles rotations internally.
- Ngôn ngữ chính
- Rust
- Star
- 5.8k
- Fork
- 401
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 10
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dimforge/rapier
-
Debug assertion in the incremental solver-contact graph when a ball rolls on a Voxels colliderCó thể đã có người làm @shtse8 đã nhận 9 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Typo in the docsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Request for more feature flagsĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
dimforge/rapier#1024 · 1 bình luận · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của dimforge/rapier
Issue tương tự
-
✨ enhancement needs-discussion
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
-
docs(openclaw): RTK_REWRITE_HOST relaxes every default ask, not only commands no rule matchedĐang mởarea:docs documentation good first issue priority:low
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
rtk-ai/rtk#4500 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
triage:accepted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
open-telemetry/otel-arrow#4343 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mishraprafful/multihull#150 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:tooling bug good first issue priority:P3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
michaelnavazhylau/ngspice-rs#129 ·
Maintainer thường phản hồi trong vòng 1 ngày