erincatto / box2d

Box2D is a 2D physics engine for games
https://box2d.org
MIT License
8.36k stars 1.54k forks source link

Some joints does not check it's input in constructor, but check on future set #715

Closed DBotThePony closed 3 months ago

DBotThePony commented 2 years ago

The b2RevoluteJoint::SetLimits method check it's input (and b2Assert them): https://github.com/erincatto/box2d/blob/9dc24a6fd4f32442c4bcf80791de47a0a7d25afb/src/dynamics/b2_revolute_joint.cpp#L425-L438

However, the constructor does not: https://github.com/erincatto/box2d/blob/9dc24a6fd4f32442c4bcf80791de47a0a7d25afb/src/dynamics/b2_revolute_joint.cpp#L50-L71

Same applies to wheel joint

This go sideways with prismatic joint which has similar properties and it check it's input for validity both in constructor and setter: https://github.com/erincatto/box2d/blob/9dc24a6fd4f32442c4bcf80791de47a0a7d25afb/src/dynamics/b2_prismatic_joint.cpp#L102 https://github.com/erincatto/box2d/blob/9dc24a6fd4f32442c4bcf80791de47a0a7d25afb/src/dynamics/b2_prismatic_joint.cpp#L532-L534