-
Notifications
You must be signed in to change notification settings - Fork 38
/
EntityManagementFeatures.cc
689 lines (603 loc) · 22.2 KB
/
EntityManagementFeatures.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
/*
* Copyright (C) 2018 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "EntityManagementFeatures.hh"
#include <memory>
#include <string>
#include <unordered_map>
#include <dart/config.hpp>
#include <dart/collision/ode/OdeCollisionDetector.hpp>
#include <dart/constraint/ConstraintSolver.hpp>
#include <dart/dynamics/FreeJoint.hpp>
#include <dart/collision/CollisionFilter.hpp>
#include <dart/collision/CollisionObject.hpp>
namespace ignition {
namespace physics {
namespace dartsim {
/////////////////////////////////////////////////
/// This class filters collision based on a bitmask:
/// Each objects has a bitmask. If the bitwise-and of two objects' bitmasks
/// evaluates to 0, then collisions between them are ignored.
class BitmaskContactFilter : public dart::collision::BodyNodeCollisionFilter
{
public: using DartCollisionConstPtr = const dart::collision::CollisionObject*;
public: using DartShapeConstPtr = const dart::dynamics::ShapeNode*;
private: std::unordered_map<DartShapeConstPtr, uint16_t> bitmaskMap;
public: bool ignoresCollision(
DartCollisionConstPtr _object1,
DartCollisionConstPtr _object2) const override
{
auto shapeNode1 = _object1->getShapeFrame()->asShapeNode();
auto shapeNode2 = _object2->getShapeFrame()->asShapeNode();
if (dart::collision::BodyNodeCollisionFilter::ignoresCollision(
_object1, _object2))
return true;
auto shape1Iter = bitmaskMap.find(shapeNode1);
auto shape2Iter = bitmaskMap.find(shapeNode2);
if (shape1Iter != bitmaskMap.end() && shape2Iter != bitmaskMap.end() &&
((shape1Iter->second & shape2Iter->second) == 0))
return true;
return false;
}
public: void SetIgnoredCollision(DartShapeConstPtr _shapePtr,
const uint16_t _mask)
{
bitmaskMap[_shapePtr] = _mask;
}
public: uint16_t GetIgnoredCollision(DartShapeConstPtr _shapePtr) const
{
auto shapeIter = bitmaskMap.find(_shapePtr);
if (shapeIter != bitmaskMap.end())
return shapeIter->second;
return 0xff;
}
public: void RemoveIgnoredCollision(DartShapeConstPtr _shapePtr)
{
auto shapeIter = bitmaskMap.find(_shapePtr);
if (shapeIter != bitmaskMap.end())
bitmaskMap.erase(shapeIter);
}
public: void RemoveSkeletonCollisions(dart::dynamics::SkeletonPtr _skelPtr)
{
for (std::size_t i = 0; i < _skelPtr->getNumShapeNodes(); ++i)
{
auto shapePtr = _skelPtr->getShapeNode(i);
this->RemoveIgnoredCollision(shapePtr);
}
}
public: virtual ~BitmaskContactFilter() = default;
};
/// Utility functions
/////////////////////////////////////////////////
static const std::shared_ptr<BitmaskContactFilter> GetFilterPtr(
const EntityManagementFeatures* _emf, std::size_t _worldID)
{
const auto world = _emf->worlds.at(_worldID);
// We need to cast the base class pointer to the derived class
const auto filterPtr = std::static_pointer_cast<BitmaskContactFilter>(
world->getConstraintSolver()->getCollisionOption()
.collisionFilter);
return filterPtr;
}
/////////////////////////////////////////////////
static std::size_t GetWorldOfShapeNode(const EntityManagementFeatures *_emf,
const dart::dynamics::ShapeNode* _shapeNode)
{
// Get the body of the shape node
const auto bn = _shapeNode->getBodyNodePtr();
// Get the body node's skeleton
const auto skelPtr = bn->getSkeleton();
// Now find the skeleton's model
const std::size_t modelID = _emf->models.objectToID.at(skelPtr);
// And the world containing the model
return _emf->models.idToContainerID.at(modelID);
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetEngineName(
const Identity &/*_engineID*/) const
{
static const std::string engineName = "dartsim-" DART_VERSION;
return engineName;
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetEngineIndex(
const Identity &/*_engineID*/) const
{
// The dartsim plugin does not make a distinction between different engine
// indexes.
return 0;
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetWorldCount(
const Identity &/*_engineID*/) const
{
return worlds.size();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetWorld(
const Identity &, std::size_t _worldIndex) const
{
const std::size_t id =
this->worlds.indexInContainerToID.begin()->second[_worldIndex];
return this->GenerateIdentity(id, this->worlds.idToObject.at(id));
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetWorld(
const Identity &, const std::string &_worldName) const
{
const std::size_t id = this->worlds.IdentityOf(_worldName);
return this->GenerateIdentity(id, this->worlds.idToObject.at(id));
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetWorldName(
const Identity &_worldID) const
{
return this->ReferenceInterface<DartWorld>(_worldID)->getName();
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetWorldIndex(
const Identity &_worldID) const
{
// TODO(anyone) this will throw if the world has been removed
return this->worlds.idToIndexInContainer.at(_worldID);
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetEngineOfWorld(
const Identity &/*_worldID*/) const
{
return this->GenerateIdentity(0);
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetModelCount(
const Identity &_worldID) const
{
return this->ReferenceInterface<DartWorld>(_worldID)->getNumSkeletons();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetModel(
const Identity &_worldID, const std::size_t _modelIndex) const
{
const DartSkeletonPtr &model =
this->ReferenceInterface<DartWorld>(_worldID)->getSkeleton(_modelIndex);
// If the model doesn't exist in "models", it means the containing entity has
// been removed.
if (this->models.HasEntity(model))
{
const std::size_t modelID = this->models.IdentityOf(model);
return this->GenerateIdentity(modelID, this->models.at(modelID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetModel(
const Identity &_worldID, const std::string &_modelName) const
{
const DartSkeletonPtr &model =
this->ReferenceInterface<DartWorld>(_worldID)->getSkeleton(_modelName);
// If the model doesn't exist in "models", it means the containing entity has
// been removed.
if (this->models.HasEntity(model))
{
const std::size_t modelID = this->models.IdentityOf(model);
return this->GenerateIdentity(modelID, this->models.at(modelID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetModelName(
const Identity &_modelID) const
{
return this->ReferenceInterface<ModelInfo>(_modelID)->model->getName();
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetModelIndex(
const Identity &_modelID) const
{
// TODO(anyone) this will throw if the model has been removed. The alternative
// is to first check if the model exists, but what should we return if it
// doesn't exist
return this->models.idToIndexInContainer.at(_modelID);
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetWorldOfModel(
const Identity &_modelID) const
{
// If the model doesn't exist in "models", it it has been removed.
if (this->models.HasEntity(_modelID))
{
const std::size_t worldID = this->models.idToContainerID.at(_modelID);
return this->GenerateIdentity(worldID, this->worlds.at(worldID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetLinkCount(
const Identity &_modelID) const
{
return this->ReferenceInterface<ModelInfo>(_modelID)
->model->getNumBodyNodes();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetLink(
const Identity &_modelID, const std::size_t _linkIndex) const
{
DartBodyNode *const bn =
this->ReferenceInterface<ModelInfo>(_modelID)->model->getBodyNode(
_linkIndex);
// If the link doesn't exist in "links", it means the containing entity has
// been removed.
if (this->links.HasEntity(bn))
{
const std::size_t linkID = this->links.IdentityOf(bn);
return this->GenerateIdentity(linkID, this->links.at(linkID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetLink` is called on a
// model that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetLink(
const Identity &_modelID, const std::string &_linkName) const
{
DartBodyNode *const bn =
this->ReferenceInterface<ModelInfo>(_modelID)->model->getBodyNode(
_linkName);
// If the link doesn't exist in "links", it means the containing entity has
// been removed.
if (this->links.HasEntity(bn))
{
const std::size_t linkID = this->links.IdentityOf(bn);
return this->GenerateIdentity(linkID, this->links.at(linkID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetLink` is called on a
// model that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetJointCount(
const Identity &_modelID) const
{
return this->ReferenceInterface<ModelInfo>(_modelID)->model->getNumJoints();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetJoint(
const Identity &_modelID, const std::size_t _jointIndex) const
{
DartJoint *const joint =
this->ReferenceInterface<ModelInfo>(_modelID)->model->getJoint(
_jointIndex);
// If the joint doesn't exist in "joints", it means the containing entity has
// been removed.
if (this->joints.HasEntity(joint))
{
const std::size_t jointID = this->joints.IdentityOf(joint);
return this->GenerateIdentity(jointID, this->joints.at(jointID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetJoint` is called on a
// model that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetJoint(
const Identity &_modelID, const std::string &_jointName) const
{
DartJoint *const joint =
this->ReferenceInterface<ModelInfo>(_modelID)->model->getJoint(
_jointName);
// If the joint doesn't exist in "joints", it means the containing entity has
// been removed.
if (this->joints.HasEntity(joint))
{
const std::size_t jointID = this->joints.IdentityOf(joint);
return this->GenerateIdentity(jointID, this->joints.at(jointID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetJoint` is called on a
// model that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetLinkName(
const Identity &_linkID) const
{
return this->ReferenceInterface<LinkInfo>(_linkID)->name;
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetLinkIndex(
const Identity &_linkID) const
{
return this->ReferenceInterface<LinkInfo>(_linkID)
->link->getIndexInSkeleton();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetModelOfLink(
const Identity &_linkID) const
{
const DartSkeletonPtr &model =
this->ReferenceInterface<LinkInfo>(_linkID)->link->getSkeleton();
// If the model containing the link doesn't exist in "models", it means this
// link belongs to a removed model.
if (this->models.HasEntity(model))
{
const std::size_t modelID = this->models.IdentityOf(model);
return this->GenerateIdentity(modelID, this->models.at(modelID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetShapeCount(
const Identity &_linkID) const
{
return this->ReferenceInterface<LinkInfo>(_linkID)->link->getNumShapeNodes();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetShape(
const Identity &_linkID, const std::size_t _shapeIndex) const
{
DartShapeNode *const sn =
this->ReferenceInterface<LinkInfo>(_linkID)->link->getShapeNode(
_shapeIndex);
// If the shape doesn't exist in "shapes", it means the containing entity has
// been removed.
if (this->shapes.HasEntity(sn))
{
const std::size_t shapeID = this->shapes.IdentityOf(sn);
return this->GenerateIdentity(shapeID, this->shapes.at(shapeID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetShape` is called on a
// link that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetShape(
const Identity &_linkID, const std::string &_shapeName) const
{
auto bn = this->ReferenceInterface<LinkInfo>(_linkID)->link;
DartShapeNode *const sn = bn->getSkeleton()->getShapeNode(
bn->getName() + ":" + _shapeName);
// If the shape doesn't exist in "shapes", it means the containing entity has
// been removed.
if (this->shapes.HasEntity(sn))
{
const std::size_t shapeID = this->shapes.IdentityOf(sn);
return this->GenerateIdentity(shapeID, this->shapes.at(shapeID));
}
else
{
// TODO(addisu) It's not clear what to do when `GetShape` is called on a
// link that has been removed. Right now we are returning an invalid
// identity, but that could cause a segfault if the use doesn't check if
// returned value before using it.
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetJointName(
const Identity &_jointID) const
{
return this->ReferenceInterface<JointInfo>(_jointID)->joint->getName();
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetJointIndex(
const Identity &_jointID) const
{
return this->ReferenceInterface<JointInfo>(_jointID)
->joint->getJointIndexInSkeleton();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetModelOfJoint(
const Identity &_jointID) const
{
const DartSkeletonPtr &model =
this->ReferenceInterface<JointInfo>(_jointID)->joint->getSkeleton();
// If the model containing the joint doesn't exist in "models", it means this
// joint belongs to a removed model.
if (this->models.HasEntity(model))
{
const std::size_t modelID = this->models.IdentityOf(model);
return this->GenerateIdentity(modelID, this->models.at(modelID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
const std::string &EntityManagementFeatures::GetShapeName(
const Identity &_shapeID) const
{
const auto shapeInfo = this->ReferenceInterface<ShapeInfo>(_shapeID);
return shapeInfo->name;
}
/////////////////////////////////////////////////
std::size_t EntityManagementFeatures::GetShapeIndex(
const Identity &_shapeID) const
{
const auto shapeInfo = this->ReferenceInterface<ShapeInfo>(_shapeID);
return shapeInfo->node->getIndexInBodyNode();
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::GetLinkOfShape(
const Identity &_shapeID) const
{
auto shapeInfo = this->ReferenceInterface<ShapeInfo>(_shapeID);
DartBodyNode *const bn = shapeInfo->node->getBodyNodePtr();
// If the link containing the shape doesn't exist in "links", it means this
// shape belongs to a removed link.
if (this->links.HasEntity(bn))
{
const std::size_t linkID = this->links.IdentityOf(bn);
return this->GenerateIdentity(linkID, this->links.at(linkID));
}
else
{
return this->GenerateInvalidId();
}
}
/////////////////////////////////////////////////
bool EntityManagementFeatures::RemoveModelByIndex(const Identity &_worldID,
std::size_t _modelIndex)
{
auto *const world = this->ReferenceInterface<DartWorld>(_worldID);
const DartSkeletonPtr &model = world->getSkeleton(_modelIndex);
if (model != nullptr && this->models.HasEntity(model))
{
auto filterPtr = GetFilterPtr(this, _worldID);
filterPtr->RemoveSkeletonCollisions(model);
this->RemoveModelImpl(_worldID, this->models.IdentityOf(model));
return true;
}
return false;
}
/////////////////////////////////////////////////
bool EntityManagementFeatures::RemoveModelByName(const Identity &_worldID,
const std::string &_modelName)
{
auto *const world = this->ReferenceInterface<DartWorld>(_worldID);
const DartSkeletonPtr &model = world->getSkeleton(_modelName);
if (model != nullptr && this->models.HasEntity(model))
{
auto filterPtr = GetFilterPtr(this, _worldID);
filterPtr->RemoveSkeletonCollisions(model);
this->RemoveModelImpl(_worldID, this->models.IdentityOf(model));
return true;
}
return false;
}
/////////////////////////////////////////////////
bool EntityManagementFeatures::RemoveModel(const Identity &_modelID)
{
if (this->models.HasEntity(_modelID))
{
auto worldID = this->models.idToContainerID.at(_modelID);
auto model = this->models.at(_modelID)->model;
auto filterPtr = GetFilterPtr(this, worldID);
filterPtr->RemoveSkeletonCollisions(model);
this->RemoveModelImpl(this->models.idToContainerID.at(_modelID), _modelID);
return true;
}
return false;
}
/////////////////////////////////////////////////
bool EntityManagementFeatures::ModelRemoved(const Identity &_modelID) const
{
return !this->models.HasEntity(_modelID);
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::ConstructEmptyWorld(
const Identity &/*_engineID*/, const std::string &_name)
{
const auto &world = std::make_shared<dart::simulation::World>(_name);
world->getConstraintSolver()->setCollisionDetector(
dart::collision::OdeCollisionDetector::create());
// TODO(anyone) We need a machanism to configure maxNumContacts at runtime.
auto &collOpt = world->getConstraintSolver()->getCollisionOption();
collOpt.maxNumContacts = 10000;
world->getConstraintSolver()->getCollisionOption().collisionFilter =
std::make_shared<BitmaskContactFilter>();
const std::size_t worldID = this->AddWorld(world, _name);
return this->GenerateIdentity(worldID, this->worlds.at(worldID));
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::ConstructEmptyModel(
const Identity &_worldID, const std::string &_name)
{
dart::dynamics::SkeletonPtr model = dart::dynamics::Skeleton::create(_name);
dart::dynamics::SimpleFramePtr modelFrame =
dart::dynamics::SimpleFrame::createShared(
dart::dynamics::Frame::World(),
_name + "_frame");
auto [modelID, modelInfo] = this->AddModel({model, modelFrame, ""}, _worldID); // NOLINT
return this->GenerateIdentity(modelID, this->models.at(modelID));
}
/////////////////////////////////////////////////
Identity EntityManagementFeatures::ConstructEmptyLink(
const Identity &_modelID, const std::string &_name)
{
auto model = this->ReferenceInterface<ModelInfo>(_modelID)->model;
dart::dynamics::FreeJoint::Properties prop_fj;
prop_fj.mName = _name + "_FreeJoint";
DartBodyNode::Properties prop_bn;
prop_bn.mName = _name;
DartBodyNode *bn =
model->createJointAndBodyNodePair<dart::dynamics::FreeJoint>(
nullptr, prop_fj, prop_bn).second;
const std::size_t linkID = this->AddLink(bn);
return this->GenerateIdentity(linkID, this->links.at(linkID));
}
void EntityManagementFeatures::SetCollisionFilterMask(
const Identity &_shapeID, const uint16_t _mask)
{
const auto shapeNode = this->ReferenceInterface<ShapeInfo>(_shapeID)->node;
const std::size_t worldID = GetWorldOfShapeNode(this, shapeNode);
const auto filterPtr = GetFilterPtr(this, worldID);
filterPtr->SetIgnoredCollision(shapeNode, _mask);
}
uint16_t EntityManagementFeatures::GetCollisionFilterMask(
const Identity &_shapeID) const
{
const auto shapeNode = this->ReferenceInterface<ShapeInfo>(_shapeID)->node;
const std::size_t worldID = GetWorldOfShapeNode(this, shapeNode);
const auto filterPtr = GetFilterPtr(this, worldID);
return filterPtr->GetIgnoredCollision(shapeNode);
}
void EntityManagementFeatures::RemoveCollisionFilterMask(
const Identity &_shapeID)
{
const auto shapeNode = this->ReferenceInterface<ShapeInfo>(_shapeID)->node;
const std::size_t worldID = GetWorldOfShapeNode(this, shapeNode);
const auto filterPtr = GetFilterPtr(this, worldID);
filterPtr->RemoveIgnoredCollision(shapeNode);
}
}
}
}