BoomingTech / Piccolo

Piccolo (formerly Pilot) – mini game engine for games104
MIT License
5.93k stars 1.83k forks source link

尝试重新加载Level时,会报错退出 #416

Closed rocketman123456 closed 1 year ago

rocketman123456 commented 1 year ago

Describe the bug | Bug描述 在实现运行时切换Level的功能时,尝试重新加载Level时,会报错退出

每次运行都会卡在JoltPhysics的这个函数中,JPH_ASSERT(!body->IsInBroadPhase());,导致无法重新加载Level

Body *BodyManager::RemoveBodyInternal(const BodyID &inBodyID)
{
    // Get body
    uint32 idx = inBodyID.GetIndex();
    Body *body = mBodies[idx];

    // Validate that it can be removed
    JPH_ASSERT(body->GetID() == inBodyID);
    JPH_ASSERT(!body->IsActive());
    JPH_ASSERT(!body->IsInBroadPhase());

    // Push the id onto the freelist
    mBodies[idx] = (Body *)mBodyIDFreeListStart;
    mBodyIDFreeListStart = (uintptr_t(idx) << cFreedBodyIndexShift) | cIsFreedBody;

    return body;
}
rocketman123456 commented 1 year ago

由于添加了character,没有正常设置,导致报错