Sphere collision don't work properly

Hi, you should check what are the collision settings for the physic model in you BP, could you screenshot it and post it ?

You said it doesnt detect other actors, but could you give an exemple ? ( static meshes or else ? )

Hi. My english is not very well, so forgive my mistakes. I have a problem with sphere collision. It don’t detect any other actor than Character, and his own.

Here is cpp:

ARubick::ARubick(const FObjectInitializer& ObjectInitializer)
{
	collisionSphere = ObjectInitializer.CreateDefaultSubobject<USphereComponent>(this, TEXT("BoxStuff"));
	collisionSphere->bGenerateOverlapEvents = true;
	collisionSphere->SetRelativeScale3D(FVector(10.0f, 10.0f, 10.0f));
	collisionSphere->AttachTo(RootComponent);
	collisionSphere->OnComponentBeginOverlap.AddDynamic(this, &ARubick::OnOverlap);
	collisionSphere->OnComponentEndOverlap.AddDynamic(this, &ARubick::OnEndOverlap);
}

void ARubick::BeginPlay()
{
	durability = 100;
}

void ARubick::Tick(float DeltaTime)
{

}

void ARubick::OnOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult)
{
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, *(OtherActor->GetFullName()));
}

void ARubick::OnEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex)
{
	if (GEngine)
		GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, *(OtherActor->GetFullName()));
}

And here is .h:

#pragma once

#include "CoreMinimal.h"
#include "ItemParent.h"
#include "Runtime/Engine/Classes/Components/CapsuleComponent.h"
#include "Rubick.generated.h"

UCLASS()
class GAME_API ARubick : public AItemParent
{
	GENERATED_BODY()
public:
	ARubick(const FObjectInitializer& ObjectInitializer);

	class USphereComponent *collisionSphere;

	UFUNCTION()
		void OnOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);

	UFUNCTION()
		void OnEndOverlap(UPrimitiveComponent* OverlappedComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);

	virtual void BeginPlay() override;
private:
	
	virtual void Tick(float DeltaTime) override;

};

Here are 2 screens:

This second cube isn’t Rubick, its ItemParent

I don’t have any blueprints

well, i suggest you to make a blueprint from you c++ class, it give you more control over some settings, really usefull for visualisation too :slight_smile:
in your constructor, add so your cube will ‘overlap’ static meshes ( so you have your event ) and not ‘hit’ them ( 2 different events )

collisionSphere->SetCollisionResponseToChannel(ECC_WorldStatic, ECR_Overlap);

Other actors on viewport are: static meshes, and ItemParent. Rubick is a child of ItemParent