Comments (3)
Hi! Sorry for the late response.
I believe there may be a mismatch with the way sprites are rendered. Where is the local origin of sprites? If it is not at the center of the sprite, then it won't match what Rapier assumes (the center of the ball in its local-space is its local origin).
from rapier.
I'm not at a computer where I can check right now, but I find it a bit hard to imagine this being a problem of the origins not being aligned. I'm saying this just looking at that motion where the top ball kind of hangs at about the half y position overlapping the lower one after falling a bit, and even pops back up briefly.
Another hint that this may be a bug was when I ran the same simulation with more sprites many of them seem to behave correctly while only a few exhibit this strange behavior. I reduced it to just the two before making this bug report to try to get the minimal reproduction.
from rapier.
You are right. I thought that perhaps the sprite center was on the top-left corner, which would cause this kind of weird behavior because a small rotation would make them appear as if there are penetrating. But if I run your code locally, I can see that when the ball rolls on the ground, it rotates properly wrt. the sprite center.
So, yes, this is a bug. However if I try your code with my local version of Rapier (the one I'm actively working on for #79), the bug appears to be gone. So chances are that this won't be a problem in the next release of Rapier.
By the way, I think you got your PIXEL_PER_METER
thing reversed. If you intend to consider that 1 meter is, say, 60 pixels, then this means that when you have 1 unit in the physics world, you get 60 units in the graphics world. So you should not scale all the physics quantities by PIXEL_PER_METER
, it is the graphics that needs to be scaled wrt. the physics. Otherwise you end up with huge objects in the physics engine (because everything is expressed in pixels) which is more prone to numerical errors.
To make this a bit easier to work with, you can set RapierConfiguration::scale
to PIXEL_PER_METER
. That way, the Rapier plugin will automatically multiply the rigid-body positions by PIXEL_PER_METER
whenever it writes their position back to the Bevy Transform
.
from rapier.
Related Issues (20)
- Crashes iOS 14 Safari
- Benchmarks webpage is not working HOT 1
- Need predict_position_using_velocity() without forces
- panic_bounds_check when solving spring joint HOT 2
- How do you simulate refraction? HOT 5
- Objects retain all velocity while moving through a Sensor HOT 4
- `KinematicCharacterController` climbing and sliding along along vertical walls are broken
- `KinematicCharacterController` doesn't respect `offest` HOT 1
- `dyn PhysicsHooks` cannot be shared between threads safely --> WASM compile fails HOT 1
- Perfectly Elastic Ball Loses Velocity After Bounces in Zero Gravity Environment HOT 2
- 2D Rigidbody type changing from Kinematic->Dynamic at runtime doesn't work HOT 2
- Bug: Incrementally-updated `QueryPipeline` memory usage linearly grows over time.
- How do I properly enable parallel in rapier3d? HOT 2
- Add support for custom friction and bounce CombineRules
- Built app WASM issue after upgrading to 0.13.1 HOT 4
- EPA convergence failure on capsules
- Very large 2d cuboid "ground" destabilizes simulation
- Perfectly elastic objects gain energy with TGS soft in Newton's cradle example HOT 1
- parry2d v0.15.0 yanked HOT 4
- rapier3d doesn't compile with simd-nightly HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rapier.