Class FrameCollider#
Defined in File FrameCollider.h
Class Documentation#
-
class FrameCollider#
Helper to bridge CollisionScene collisions to Frames.
See Collision dynamics for more discussion on contact and collision dynamics.
Public Types
-
using col_func = std::function<void(const FrameContact&)>#
Type alias for collision handler callbacks.
-
using filter_func = std::function<bool(const Karana::Scene::CollisionScenePart&, const Karana::Scene::CollisionScenePart&)>#
Type alias for collision filter callbacks.
Public Functions
-
FrameCollider(const Karana::Core::ks_ptr<Karana::Scene::ProxyScene> &proxy_scene, const Karana::Core::ks_ptr<Karana::Scene::CollisionScene> &collision_scene)#
FrameCollider constructor.
- Parameters:
proxy_scene – - The ProxyScene managing the CollisionScene
collision_scene – - The CollisionScene instance
-
FrameCollider(const FrameCollider &other) = default#
FrameCollider copy constructor.
- Parameters:
other – - The FrameCollider to copy.
-
FrameCollider &operator=(const FrameCollider &other) = default#
FrameCollider copy assignment operator.
- Parameters:
other – - The FrameCollider to copy.
- Returns:
This FrameCollider.
-
virtual ~FrameCollider()#
-
void collide(col_func collision_handler, filter_func filter = nullptr)#
Process all collisions.
Sweeps through all contacts between geometries attached to Frames, calling the collision handler for each unfiltered contact.
- Parameters:
collision_handler – - Callback to handle a contact
filter – - Callback to skip potential collisions in the broadphase.
-
Karana::Core::ks_ptr<Karana::Frame::Frame> lookupPartFrame(const Karana::Scene::CollisionScenePart &part)#
Get the Frame that a CollisionScenePart is attached to.
- Parameters:
part – - A CollisionScenePart managed by ProxyScene
- Returns:
The ancestor Frame for the part.
-
Karana::Core::ks_ptr<Karana::Frame::Frame> lookupPartFrame(Karana::Core::id_t id)#
Get the Frame that a CollisionScenePart is attached to.
- Parameters:
id – - The id of a CollisionScenePart managed by ProxyScene
- Returns:
The ancestor Frame for the part.
-
void ignoreFramePair(const Karana::Core::ks_ptr<Karana::Frame::Frame> &frame1, const Karana::Core::ks_ptr<Karana::Frame::Frame> &frame2)#
Ignore collisions between a pair of frames.
- Parameters:
frame1 – The first frame in the pair
frame2 – The second frame in the pair
-
void unignoreFramePair(const Karana::Core::ks_ptr<Karana::Frame::Frame> &frame1, const Karana::Core::ks_ptr<Karana::Frame::Frame> &frame2)#
Stop ignoring collisions between a pair of frames.
- Parameters:
frame1 – The first frame in the pair
frame2 – The second frame in the pair
-
void ignoreAllCurrentlyTouchingPairs()#
Call ignoreFramePair for each pair with a collision.
-
void clearIgnoredFramePairs()#
Stop ignoring any frame-pair collisions.
-
using col_func = std::function<void(const FrameContact&)>#