// Defined in cpSpace.c // Wake up a sleeping or idle body. public void Activate() { if (bodyType == cpBodyType.DYNAMIC) { nodeIdleTime = 0.0f; cpBody root = nodeRoot; if (root != null && root.IsSleeping()) { // TODO should cpBodyIsSleeping(root) be an assertion? cp.AssertSoft(root.bodyType == cpBodyType.DYNAMIC, "Internal Error: Non-dynamic body component root detected."); cpSpace space = root.space; cpBody body = root; while (body != null) { cpBody next = body.nodeNext; body.nodeIdleTime = 0.0f; body.nodeRoot = null; body.nodeNext = null; space.ActivateBody(body); body = next; } space.sleepingComponents.Remove(root); } eachArbiter((arb, o) => { // Reset the idle timer of things the body is touching as well. // That way things don't get left hanging in the air. cpBody other = (arb.body_a == this ? arb.body_b : arb.body_a); if (other.bodyType != cpBodyType.STATIC) { other.nodeIdleTime = 0.0f; } }, null); } }