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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix missing direction of ray (#3297) #3298

Open
wants to merge 1 commit into
base: gazebo11
Choose a base branch
from

Conversation

ffgao
Copy link

@ffgao ffgao commented Feb 8, 2023

馃 Bug fix

Fixes #3297

Summary

When 'relativeEndPos' and 'relativeStartPos' are close, zero vector will be generated, which will cause the ray to lose its direction forever.

void RayShape::SetLength(double _len)
{
  this->contactLen = _len;

  ignition::math::Vector3d dir = this->relativeEndPos - this->relativeStartPos;
  dir.Normalize();

  this->relativeEndPos = dir * _len + this->relativeStartPos;
}

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

@ffgao
Copy link
Author

ffgao commented Jun 2, 2023

Expected behavior:
image

217426318-f8fe26ec-80e8-47b8-aa6b-b213b2a70510

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rays through models, and never recover
1 participant