Example #1
0
void Body::updateBeforePhysics() {
    if (!isActive()) {
        return;
    }

    if (mFixturesDirty) {
        createFixtures();
        mFixturesDirty = false;
        mTransformDirty = true;
    }

    if (mTransformDirty) {
        Actor* actor = getActor();
        if (actor) {
            QPointF pos = actor->position();
            mBody->SetTransform(b2Vec2(pos.x(), pos.y()), qDegreesToRadians(actor->rotation()));
        }
        mTransformDirty = false;
    }
}
Example #2
0
void Entity::createB2Data() {
  createBody();
  createFixtures();
  _body->SetUserData(this);
}