| 82 | } |
| 83 | |
| 84 | Joint* 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 | |
| 113 | Joint* Joint::gear( |
| 114 | bool collideConnected, |
nothing calls this directly
no test coverage detected