MCPcopy Create free account
hub / github.com/axmolengine/axmol / createConstraints

Method createConstraints

core/physics/PhysicsJoint.cpp:270–293  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270bool PhysicsJointFixed::createConstraints()
271{
272 do
273 {
274 _bodyA->getNode()->setPosition(_anchr);
275 _bodyB->getNode()->setPosition(_anchr);
276
277 // add a pivot joint to fixed two body together
278 auto joint = cpPivotJointNew(_bodyA->getCPBody(), _bodyB->getCPBody(), PhysicsHelper::vec22cpv(_anchr));
279 AX_BREAK_IF(joint == nullptr);
280 _cpConstraints.emplace_back(joint);
281
282 // add a gear joint to make two body have the same rotation.
283 joint = cpGearJointNew(_bodyA->getCPBody(), _bodyB->getCPBody(), 0, 1);
284 AX_BREAK_IF(joint == nullptr);
285 _cpConstraints.emplace_back(joint);
286
287 _collisionEnable = false;
288
289 return true;
290 } while (false);
291
292 return false;
293}
294
295PhysicsJointPin* PhysicsJointPin::construct(PhysicsBody* a, PhysicsBody* b, const Vec2& pivot)
296{

Calls 15

cpPivotJointNewFunction · 0.85
cpGearJointNewFunction · 0.85
cpPivotJointNew2Function · 0.85
cpSlideJointNewFunction · 0.85
cpPinJointNewFunction · 0.85
cpDampedSpringNewFunction · 0.85
cpGrooveJointNewFunction · 0.85
cpDampedRotarySpringNewFunction · 0.85
cpRotaryLimitJointNewFunction · 0.85
cpRatchetJointNewFunction · 0.85
cpSimpleMotorNewFunction · 0.85
local2WorldMethod · 0.80

Tested by

no test coverage detected