-
Hi, I was trying out the C++ API, and I am a bit confused with how the DynamicAABBTreeCollisionManager should be used. I would appreciate any suggestions to make the my code more efficient. Currently this is what I am doing hpp::fcl::DynamicAABBTreeCollisionManager m = hpp::fcl::DynamicAABBTreeCollisionManager();
// load objects
std::vector<hpp::fcl::CollisionObject*> collisionObjects;
collisionObjects.push_back(ObjPtr0.get());
collisionObjects.push_back(ObjPtr1.get());
collisionObjects.push_back(ObjPtr2.get());
m.registerObjects(collisionObjects);
hpp::fcl::CollisionGeometryPtr_t modelPtr = std::make_shared<hpp::fcl::Box>(0.5, 2.4, 2.0);
std::shared_ptr<hpp::fcl::CollisionObject> objPtr = std::make_shared<hpp::fcl::CollisionObject>(modelPtr);
// I am skipping the transformation settings for now
hpp::fcl::CollisionCallBackDefault callback;
callback.init();
callback.data.result.clear();
callback.data.done = false;
m.collide(objPtr.get(), &callback);
bool isCollision = callback.data.result.isCollision(); I think this works, but I am not sure if this is the intended usage, or if I am doing anything wrong. The tests might be doing something similar but I am new to C++ and the code is a bit confusing for me. Thanks for any suggestions! |
Beta Was this translation helpful? Give feedback.
Answered by
jcarpent
Feb 11, 2024
Replies: 1 comment 1 reply
-
This looks good to me. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
jcarpent
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This looks good to me.