I am working on a simulation of a cable looped around the perimeter of a net through a set of rings. I need the cable to have a collision geometry, but need collisions between the cable and ring parts (which are modeled as spheres) to be disabled so that the cable can pass directly through the center of the rings. I assume this could be done using a collision rule, similar to these:
VxCollisionRule collisionRule(assembly->getVxAssembly(), true);
VxCollisionRule collisionRule1(Part1->getVxPart(), Part2->getVxPart(), false);
However, since the cable system is an Extension, how can I make a collision rule between the cable Extension and a Part (or several parts)?
I need to do this using the SDK, not the editor.
A VxCollisionRule is only for the core physics engine. Since you want to manage collisions between higher level objects (VxDynamics namespace and VxExtensions) you need to use the higher-level collision rules:
The Generic Cable has an API to get its collision groups. The collision groups represent the collidable elements in the individual cable segments. There is one for each segment.
They can be accessed by taking your cable extension (cableExtension) and getting access to its ICollidable API via VxSmartInterface<VxDynamics::ICollidable> collidableCable(cableExtension);
On the collidableCable you can now use the ICollidable API to get all its collision groups.
See here how to do this:
For the group you want to disable collisions with you can now create a VxDynamics::CollisionRule. And in it you can specify the name of the collision group you want to disable collisions with (the name of the respective cable segment's collision group).
Here is how:
VxDynamics::CollisionRule rule("myRuleName"); rule.firstExtension = ringExtension; rule.secondExtension = cableExtension; const std::string nameOfSegmentCollisionGroup = ... // get the name from the ICollidable API as described above rule.secondGroupName = nameOfSegmentCollisionGroup;
Now you need to add this rule to a VxDynamics::CollisionRuleContainerExtension which you can add to your scene.
See here for CollisionRuleContainerExtension API:
You need to create it via the VxExtensionFactory using its factory key. Or you can just do
VxSmartInterface<VxDynamics::CollisionRuleContainer> myContainer = VxSmartInterface<VxDynamics::CollisionRuleContainer>::create();
Then you add the container to your scene and add the rule above to it via myContainer.collisionRuleContainer.push_back(rule).
Let me know if this works for you
I ended up just offsetting the ring definitions so that the cable is wrapped around the outer perimeter of the net, and not "through" the perimeter (and this makes more sense from a design point of view). I'll definitely try what you suggested if I need it in the future, so thanks for the help!
Ok. That works, too.
Let me know if it worked once you tried the other way.