Download

How I should work with MapBoundaries with C++?

Following BP tutorial about RTS game development, with topic about map boundaries

  1. I create a custom Objects Channel “MapBoundaries”
  2. Add several Block Volumes and setup its collision presents with “Custom…, CollisionEnabled, MapBoundaries(channel), camera block(true)”
    3… Now I should setup same collision presets in camera pawn root scene component, but I want to do this c++ coding way, because i don’t give any access to this scene component for child blueprint pawn.

How I can do that?

// Collision Setup
	SphereComponent->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
	SphereComponent->SetCollisionResponseToAllChannels(ECollisionResponse::ECR_Ignore);
	SphereComponent->SetCollisionResponseToChannel(ECollisionChannel::ECC_GameTraceChannel1, ECollisionResponse::ECR_Block);
	// ECollisionChannel::ECC_GameTraceChannel1 is first custom object channel: MapBoundaries

	SpringArm->bDoCollisionTest = true;
	SpringArm->ProbeSize = 12;
	SpringArm->ProbeChannel = ECollisionChannel::ECC_Camera;