Skip to content
This repository has been archived by the owner on Feb 3, 2025. It is now read-only.

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

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rays through models, and never recover
1 participant