How to draw 3d debug shape into scene with C++ in Lumberyard?

In CryEngine, I do this to draw 3d debug shape (sphere, direction vector, quaternion,…)

            IPersistantDebug *pDebug = gEnv->pGameFramework->GetIPersistantDebug();
if (pDebug)
pDebug->Begin("InteractionVector", false);
const ColorF color(Vec3(1, 0, 0), 0.5f);
Vec3 pos = GetEntity()->GetWorldPos() + GetEntity()->GetWorldRotation().GetColumn2() * 2.0f;
pDebug->AddSphere(pos, 0.1f, color, 1.0f);

In Lumberyard, I think the gEnv is no longer used, We’re in Gem now. So how can I draw debug shape in 3D with Lumberyard?


From a Cry3DEngineBase object you can call GetRenderer()->GetIRenderAuxGeom(), it has several functions that can be used for debugging.

I see that the struct is from CryEngine: dev\Code\CryEngine\Cry3DEngine\Cry3DEngineBase.h .So to use it in Lumberyard, we need some extra setup right?

Pretty much anything dealing with rendering inherits from Cry3DEngineBase, so there should be an object near your draw call that has it as a base.