Open tliron opened 5 months ago
I made some progress on this. Through trial and error I discovered that the NaN problem pops up when I change the Transform::scale
. I'm not really sure why it would have this effect. Does the Transform::scale
affect collider sizes or other associated components of RigidBody
?
Another discovery. The scale cannot have 0 in its z axis. This is surprising because we are working in 2D. But apparently something in the calculation still takes the z axis into account.
I would consider this a bug. At least it's something that should be documented.
I've spent hours tried to debug this, but am stuck and need some help. Using bevy_xpbd_2d.
I tried to naïvely (following the documentation) add a
RigidBody
to an existingSpriteBundle
entity. But then theTransform::translation
x y values immediately go to NaN and the sprite of course disappears. Actually rotation also becomesQuat(0.0, 0.0, NaN, NaN)
, I'm confident those are related.I've tried so many things! Different types of
RigidBody
(includingStatic
) have the same effect. Removing all gravity, including inserting aGravityScale
of 0, same effect.LockedAxes::ALL_LOCKED
, same effect. Explicitly adding aPosition
at 0, same effect. Adding colliders andMassPropertiesBundle
, same effect.I just don't know what could possibly be causing this. Is it applying some velocity or force from something else? Is the sync between
Position
andTranslation
going wrong? There are no debug messages at all from bevy_xpbd_2d.