Collider to multiple rigid bodies, how? #564
-
Hi, I want two rigid bodies to collide with a given collider. Red arrow: expected movement The issue is that attaching a collider to a rigid body basically moves it I need to attach the collider to two rigid bodies. Cloning the collider leads to a really long simulation (I mean it) so there must be a different way to achieve this. Right now, the two balls just fall as if the collider didn't exist.
How to achieve this ? pretty sure it is stupid but couldn't find out. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
It is not possible to attach a single collider to the same rigid-body. The code snippet your provide are actually creating two distinct colliders with the same shape, attached to two distinct rigid-body. It looks like you are trying to have the one rigid-body’s motion constrained based on the motion of another rigid-body. To achieve that, you can attach the two rigid-bodies with a constraint like a Another (more efficient and numerically robust) option is to only have a single rigid-body and attach the two ball colliders to that rigid-body. But of cours, this means you don’t get one rigid-body per ball (which might or might not be an issue depending on your use-case). |
Beta Was this translation helpful? Give feedback.
It is not possible to attach a single collider to the same rigid-body. The code snippet your provide are actually creating two distinct colliders with the same shape, attached to two distinct rigid-body. It looks like you are trying to have the one rigid-body’s motion constrained based on the motion of another rigid-body. To achieve that, you can attach the two rigid-bodies with a constraint like a
FixedJoint
.Another (more efficient and numerically robust) option is to only have a single rigid-body and attach the two ball colliders to that rigid-body. But of cours, this means you don’t get one rigid-body per ball (which might or might not be an issue depending on your use-case).