MCPcopy Create free account
hub / github.com/IppClub/Dora-SSR / friction

Method friction

Source/Physics/Joint.cpp:84–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84Joint* Joint::friction(
85 bool collideConnected,
86 Body* bodyA,
87 Body* bodyB,
88 const Vec2& worldAnchor,
89 float maxForce,
90 float maxTorque) {
91 if (bodyA->getPhysicsWorld() != bodyB->getPhysicsWorld()) {
92 return nullptr;
93 }
94 pr::BodyID bA = bodyA->getPrBody();
95 pr::BodyID bB = bodyB->getPrBody();
96 pr::Vec2 a = PhysicsWorld::prVal(worldAnchor);
97 auto world = bodyA->getPhysicsWorld();
98 if (!world || !world->getPrWorld()) {
99 return nullptr;
100 }
101 auto& prWorld = *world->getPrWorld();
102 Joint* joint = Joint::create();
103 joint->_world = world;
104 joint->_joint = pd::CreateJoint(prWorld,
105 pd::FrictionJointConf{bA, bB, a}
106 .UseMaxForce(maxForce)
107 .UseMaxTorque(maxTorque)
108 .UseCollideConnected(collideConnected));
109 joint->_world->setJointData(joint->_joint, joint);
110 return joint;
111}
112
113Joint* Joint::gear(
114 bool collideConnected,

Callers

nothing calls this directly

Calls 7

getPrBodyMethod · 0.80
getPrWorldMethod · 0.80
UseCollideConnectedMethod · 0.80
setJointDataMethod · 0.80
createFunction · 0.50
CreateJointFunction · 0.50
getPhysicsWorldMethod · 0.45

Tested by

no test coverage detected