Difficulty with collisions

I’m moving some code from an earlier project to the new 4.10 release. But I’ve run into trouble with the collisions. I have a rocket actor which refuses to collide with pretty much everything. The only thing it collides with is the player. It won’t collide with static meshes or BSP brushes. The rocket is a skeletal mesh with a capsule subcomponent for collision. The capsule has been set to enable collisions with QueryAndPhysics mode set. The collision profile mostly BlockAll except for camera and visibility which are set to ignore. I’ve tried various object types from my custom channel to WorldDynamic and Pawn. Nothing seems to work. Something is not turned on, but I can’t find what it could be. Hints?

I’m no expert but if you have visibility turned off unless the static meshes have a physics component it won’t collide with them. Probably best to post an code of what you have selected for its collision properties.

Also this article really helped me break down collisions in UE4: Collision Filtering - Unreal Engine

This is the code setting the collision capsule:



        CollisionComp = ObjectInitializer.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("RocketCapsuleComp"));
	if (CollisionComp)
	{
	        CollisionComp->SetCapsuleSize(6.0f, 10.0f);
		CollisionComp->AlwaysLoadOnClient = true;
		CollisionComp->AlwaysLoadOnServer = true;
		CollisionComp->bTraceComplexOnMove = true;
		
		CollisionComp->AttachParent = RootComponent;
		CollisionComp->SetRelativeLocationAndRotation(FVector(10.0f, 0, 0), FRotator(90.0f, 0, 0));
		
		static FName CollisionProfileName(TEXT("BlockAllDynamic"));
		CollisionComp->SetCollisionProfileName(CollisionProfileName);
		
		CollisionComp->CanCharacterStepUpOn = ECB_No;
		CollisionComp->bShouldUpdatePhysicsVolume = true;
		CollisionComp->SetNotifyRigidBodyCollision(true);
	}

Later, in PostInitialize, this code gets called to set the callbacks:



        if (CollisionComp)
	{
		CollisionComp->OnComponentBeginOverlap.AddDynamic(this, &AWFProjectile::OnOverlap);
		CollisionComp->OnComponentHit.AddDynamic(this, &AWFProjectile::OnImpact);
	}

This code was working in the earlier version. I’m not sure what happened to make it no longer work correctly.

OK, I think I found the problem. It seems that if you want your actor to have collisions that work properly, the capsule must be the parent component and any meshes or particle effects must be child components. Otherwise, the collision system works erratically.