Hi I’m trying to implement this is C++
I have an enemy class, I can handle collisions when they happen with various objects, however when enemies of the same type hit each other, I’d like them to ignore each other completely and pass through. Right now if they hit each other they block.
I don’t code, but I do know you can add new collision channels to your projects under Edit → Project Settings → Collision. Perhaps you can just refer to the new channel in the same manner you refer to the Pawn/WorldStatic/WorldDynamic channels already?
In Blueprint I simply create my new BP, then set their collision to either ignore or overlap each other.
This is the properties for a Basic Enemy BP. Notice at the bottom there is 3 new channels, Enemy, Player and Bullet. I have set the Enemy Collision to Ignore. Hope that helps.
I can see how your suggestion should work, but I couldn’t get it to work, and really I don’t want enemies of my class ignoring all objects derived from “Pawn”, just ignoring objects of their own class.
Thanks for the reply, though, I do appreciate it.
I stumbled onto something that is working for me. I am using a class a member function called “OnHit” to determine how to react to various classes on collison.
To get objects of my class “Tumblr” to ignore other objects of the same class…
void ATumblr::OnHit(AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit)
if ((OtherActor != NULL) && OtherActor->IsA(ATumblr::StaticClass()))
This seems to work, though I have encountered a couple cases where it seems to ignore objects that should be destroying it…
Any other ideas?
The missed collisions I was seeing were due to another bug in my game. This method works perfectly.