Closed hocop closed 3 weeks ago
Hi,
There is another issue for the same problem : https://github.com/Jondolf/avian/issues/416
But thanks for the gif ^^
ps : I think your problem is coming from the fact that when you're little cube is colliding with your larger cube, it may create an angle between them that is forbidden. But I must say it's quite strange that it works on the left side :/
Thanks for link!
I think the problem might be here
pub fn add_angle(&self, radians: Scalar) -> Self {
Rotation::from_sin_cos(self.sin + radians * self.cos, self.cos - radians * self.sin)
.normalize()
}
This input to from_sin_cos
can be invalid in case of big angles. And it is already validated inside the function call to be normalized.
It can explain my case: with great impact XPBD tries to apply a big update on angles and fails. It also explains 416 as clicking in this demo makes big xpbd updates.
My solution would be to implement add_angle
as:
pub fn add_angle(&self, radians: Scalar) -> Self {
Rotation::from_radians(radians) * self
}
More computation but more precise. I will try it and see if it fixes the problem
Some mechanical systems produce this error:
It is hard to reproduce, but I can provide a gif of one such system:
It is just two
round_rectangle
's connected with aRevoluteJoint
. It consistently errors out when the system (it represents a truck) folds on itself. But only on the right side. All other collisions in my game work fine.P.S. I totally do not exclude that this might be my fault, and i just don't see it. Will gladly provide more details/logs if needed