BoomingTech / Piccolo

Piccolo (formerly Pilot) – mini game engine for games104

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

rocketman123456 opened this issue · comments

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;
}

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