Re: Proximitry Trigger creatoin in C++

#6
hodirt wrote:Yes, both of these.

You may use debug renderer for this

Code: Select all


void CMyAreaTriggerEntity::Update(SEntityUpdateContext & ctx)
{
   // method 1
   static IPersistantDebug* debug = gEnv->pGameFramework->GetIPersistantDebug();
   debug->Begin("CustomDebug", true);
   Vec3 lineBegin(0, 0, 0);
   Vec3 lineEnd(0, 1, 0);
   debug->AddLine(lineBegin, lineEnd, ColorF(1, 1, 0, 1), 1.0f);
   debug->AddSphere(lineBegin, 0.1f, ColorF(1, 0, 0, 1), 1.0f);
   debug->AddSphere(lineEnd, 0.1f, ColorF(1, 0, 0, 1), 1.0f);


   // method 2
   ColorF color(1, 1, 1, 1);
   if (IRenderAuxGeom* debugRender = gEnv->pRenderer->GetIRenderAuxGeom())
   {
      debugRender->DrawLine(lineBegin, color, lineEnd, color, 1.0f);
      //debugRender->DrawLines(...);
      const Vec3 size(0.1f, 0.1f, 0.1f);
      AABB bb(-size, size); // local volume
      AABB::CreateTransformedAABB(Matrix34::CreateTranslationMat(lineBegin), bb); // translate volume
      debugRender->DrawAABB(bb, true, ColorB(255, 255, 255), EBoundingBoxDrawStyle::eBBD_Faceted);
   }

Re: Proximitry Trigger creatoin in C++

#9
hodirt wrote: ...that are seen only in debug mode?

You may use CVARs for this, and set 1 or 0 to turn-off or turn-on the debug volume for triggers (from Sandbox console or game console )

Code: Select all

   if (GetCVars().drawVolume)
   {
      AABB aabb;
      GetEntity()->GetLocalBounds(aabb);
      OBB obb(OBB::CreateOBBfromAABB(Matrix33(GetEntity()->GetWorldTM()), aabb));
      gEnv->pRenderer->GetIRenderAuxGeom()->DrawOBB(obb, GetEntity()->GetWorldTM(), false, ColorB(255, 255, 0), EBoundingBoxDrawStyle::eBBD_Faceted);
   }


222.jpg
222.jpg (35.71 KiB) Viewed 1001 times


123.jpg
123.jpg (157.04 KiB) Viewed 1001 times


take a look on last my commit (https://github.com/CopyPasteBugs/VFiles ... 537daf5dfe)

Who is online

Users browsing this forum: No registered users and 2 guests