Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usage of magic numbers in DynamicRaycastVehicleController #495

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JohnTheCoolingFan
Copy link

Usage of magic numbers is discouraged in rust in favor of enums. I've replaced magic numbers that denote axes with an enum that can be converted to an integer when needed. The enum uses less bytes and does not allow invalid states.

pub enum Axis {
X = 0,
Y = 1,
Z = 2,
Copy link
Contributor

@Vrixyz Vrixyz May 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in case of 2d dimension, the ZAxis is invalid though, this line should be gated by a

Suggested change
Z = 2,
#[cfg(feature = "dim3")]
Z = 2,

@Vrixyz Vrixyz added C-Enhancement New feature or request C-User experience Potential user-experience improvements 2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics P-Low D-Easy labels May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2D The issue is specifically about the 2D version of Rapier. 3D The issue is specifically about the 3D version of Rapier. A-Dynamics C-Enhancement New feature or request C-User experience Potential user-experience improvements D-Easy P-Low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants