I know there is a “Assertion failed: (IsLocked() == false” problem caused by world->step(…) in update function. And I have to had my bullet stored after initialization
bDef.type = b2_dynamicBody;
bDef.position.Set(herobody->GetPosition().x, herobody->GetPosition().y);
b = world->CreateBody(&bDef);
b2FixtureDef fixturebDef;
b2CircleShape circlebShape;
circlebShape.m_radius = 0.05;
fixturebDef.shape = &circlebShape;
b->CreateFixture(&fixturebDef);
but i dont know how to change the current position of bullet connected with herobody
setTransform make Asseration Failed, and then i will applylinearimpulse
/// b->SetTransform(b2Vec2(herobody->GetPosition().x, herobody->GetPosition().y), 0); // DOES NOT WORK;/
b->ApplyLinearImpulse(b2Vec2(5, 0), b->GetWorldCenter(),true);
Can anyone know how to fix it or how to write correct function for this?