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

Method setBody

core/physics/PhysicsShape.cpp:261–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

259}
260
261void PhysicsShape::setBody(PhysicsBody* body)
262{
263 // already added
264 if (body && _body == body)
265 {
266 return;
267 }
268
269 if (_body)
270 {
271 _body->removeShape(this);
272 }
273
274 for (auto&& shape : _cpShapes)
275 {
276 cpShapeSetBody(shape, body == nullptr ? s_sharedBody : body->_cpBody);
277 }
278 _body = body;
279}
280
281// PhysicsShapeCircle
282PhysicsShapeCircle* PhysicsShapeCircle::create(float radius,

Callers 3

addShapeMethod · 0.45
removeShapeMethod · 0.45
removeAllShapesMethod · 0.45

Calls 2

cpShapeSetBodyFunction · 0.85
removeShapeMethod · 0.45

Tested by

no test coverage detected