(I'm not really sure if this is actually a bug or not (hence "potential"), but still reporting here, as such mistakes can be hard to find otherwise.)
I was lurking through the code in PhysicsBody2D.gd and accidentally found what seems to be a pretty sneaky mistake.
|
if move_and_collide(rayHitVec-(normHitVec*($HitBox.shape.size.y/2))-Vector2(0,yGroundDiff).rotated(rotation),true,true,true): |
According to the
documentation for move_and_collide(), the 3'rd argument (
safe_margin) is supposed to be
float, not
bool.
Now what makes this mistake "sneaky" is that GDScript automatically (implicitly) converts that value from bool to float (in this case, from true to 1.0, while the default value of that argument is 0.08), never warning about a type mismatch, which is why the abovementioned line essentially becomes
if move_and_collide(rayHitVec-(normHitVec*($HitBox.shape.size.y/2))-Vector2(0,yGroundDiff).rotated(rotation),true,1.0,true):
I'm not very well acquainted with the physics code, so I'm asking more experienced users/devs: is argument safe_margin here really supposed to be 1.0? If not, what would be the best way to fix it?
(I'm not really sure if this is actually a bug or not (hence "potential"), but still reporting here, as such mistakes can be hard to find otherwise.)
I was lurking through the code in
PhysicsBody2D.gdand accidentally found what seems to be a pretty sneaky mistake.SonicWorldsNext/Scripts/Objects/PhysicsObject.gd
Line 265 in 99d4ff5
According to the documentation for
move_and_collide(), the 3'rd argument (safe_margin) is supposed to befloat, notbool.Now what makes this mistake "sneaky" is that GDScript automatically (implicitly) converts that value from
booltofloat(in this case, fromtrueto1.0, while the default value of that argument is0.08), never warning about a type mismatch, which is why the abovementioned line essentially becomesI'm not very well acquainted with the physics code, so I'm asking more experienced users/devs: is argument
safe_marginhere really supposed to be1.0? If not, what would be the best way to fix it?