| 233 | } |
| 234 | |
| 235 | Joint* Joint::pulley( |
| 236 | bool collideConnected, |
| 237 | Body* bodyA, |
| 238 | Body* bodyB, |
| 239 | const Vec2& anchorA, |
| 240 | const Vec2& anchorB, |
| 241 | const Vec2& groundAnchorA, |
| 242 | const Vec2& groundAnchorB, |
| 243 | float ratio) { |
| 244 | if (bodyA->getPhysicsWorld() != bodyB->getPhysicsWorld()) { |
| 245 | return nullptr; |
| 246 | } |
| 247 | pr::BodyID bA = bodyA->getPrBody(); |
| 248 | pr::BodyID bB = bodyB->getPrBody(); |
| 249 | auto world = bodyA->getPhysicsWorld(); |
| 250 | if (!world || !world->getPrWorld()) { |
| 251 | return nullptr; |
| 252 | } |
| 253 | auto& prWorld = *world->getPrWorld(); |
| 254 | pr::Vec2 aA = pd::GetWorldPoint(prWorld, bA, PhysicsWorld::prVal(anchorA)); |
| 255 | pr::Vec2 aB = pd::GetWorldPoint(prWorld, bB, PhysicsWorld::prVal(anchorB)); |
| 256 | pr::Vec2 gA = PhysicsWorld::prVal(groundAnchorA); |
| 257 | pr::Vec2 gB = PhysicsWorld::prVal(groundAnchorB); |
| 258 | Joint* joint = Joint::create(); |
| 259 | joint->_world = world; |
| 260 | joint->_joint = pd::CreateJoint(prWorld, |
| 261 | pd::GetPulleyJointConf(prWorld, bA, bB, gA, gB, aA, aB) |
| 262 | .UseRatio(ratio) |
| 263 | .UseCollideConnected(collideConnected)); |
| 264 | world->setJointData(joint->_joint, joint); |
| 265 | return joint; |
| 266 | } |
| 267 | |
| 268 | MotorJoint* Joint::revolute( |
| 269 | bool collideConnected, |
nothing calls this directly
no test coverage detected