Skip to content

Commit

Permalink
Support Capsule and Ellipsoid in Scene3D
Browse files Browse the repository at this point in the history
Signed-off-by: ahcorde <[email protected]>
  • Loading branch information
ahcorde committed Apr 28, 2021
1 parent 4df7622 commit 14f6cd5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
#include <ignition/plugin/Register.hh>
#include <ignition/common/MeshManager.hh>

#include <ignition/rendering/Capsule.hh>

#include <ignition/math/Vector2.hh>
#include <ignition/math/Vector3.hh>

Expand Down Expand Up @@ -681,6 +683,20 @@ rendering::GeometryPtr SceneManager::LoadGeometry(const msgs::Geometry &_msg,
scale.Y() = scale.X();
scale.Z() = _msg.cylinder().length();
}
else if (_msg.has_capsule())
{
auto capsule = this->scene->CreateCapsule();
capsule->SetRadius(_msg.capsule().radius());
capsule->SetLength(_msg.capsule().length());
geom = capsule;
}
else if (_msg.has_ellipsoid())
{
geom = this->scene->CreateSphere();
scale.X() = _msg.ellipsoid().radii().x() * 2;
scale.Y() = _msg.ellipsoid().radii().y() * 2;
scale.Z() = _msg.ellipsoid().radii().z() * 2;
}
else if (_msg.has_plane())
{
geom = this->scene->CreatePlane();
Expand Down

0 comments on commit 14f6cd5

Please sign in to comment.