Component Overlap event

G’day,

I am currently trying to get overlap events to work with skeletal mesh components.

They work fine with static mesh components. Enable Generate Overlap Events, add overlap event, done.

With skeletal mesh components, I have tried enabling Generate Overlap Events, custom collision, creating physics state, fixing bones, simulating physics etc, but none of it works.

In both case - static or skeletal - collision works.

If anyone has any suggestions on what I have forgotten to do, please let me know.

Thank you.

Kris

Dear Kris,

Based on tests I did just now I dont think Skeletal meshes are currently “wired” to track overlap events.

If any devs or people who know better see this, here are my tests below that lead me to this conclusion.

Note I am setting

CurrentWeaponSkelMesh->bGenerateOverlapEvents = true;
    	CurrentWeaponSkelMesh->bMultiBodyOverlap = false;

every single tick,

but

ShouldTrackOverlaps()

is always returning false for my skel mesh, much as the comment below in the Source code says:

Primitive Component.h

/** Returns true, if this component tracks overlaps. This might be false for multi-body components like SkelMeshes or Destructibles. Even if 
	false, other components can still overlap this component. */
virtual bool ShouldTrackOverlaps() const { return true; };

my test code

//~~~~~~~~~~~~
	//TEST ONLY
	VICTORY_GETPC
	
	//test player sword only
	if(!IsPlayer) return;
	//~~~~~~~~~~~~
	VictoryPC->Optimize(GetName());
	if(!CurrentWeaponSkelMesh) return;
	VictoryPC->Optimize(CurrentWeaponSkelMesh->GetName());
	
	//does track overlaps?
	CurrentWeaponSkelMesh->bGenerateOverlapEvents = true;
	CurrentWeaponSkelMesh->bMultiBodyOverlap = false;
	
	if(CurrentWeaponSkelMesh->ShouldTrackOverlaps()) VictoryPC->Optimize("YES tracks overlaps");
	else VictoryPC->Optimize("NO DOES NOT TRACK overlaps");
	
	TArray OverlapActors;
	CurrentWeaponSkelMesh->GetOverlappingActors(OverlapActors);//, AVictoryPlayerCharacterBase::StaticClass());
	
	int32 Numlaps = OverlapActors.Num();
	VictoryPC->OptInt("Num Overlaps", Numlaps );
	if(Numlaps > 0 && OverlapActors[0]) if(JoyHUD) JoyHUD->Optimize(OverlapActors[0]->GetName());
	//~~~~~

results:

#So What is the Solution?

#Trace Component

You will probably want to component-level traces each tick whenever you are anticipating skeletal component to hit something important.

I have a BP node to facilitate the use of the existing trace BP nodes, called TraceData

which helps you calculate the trace start and trace end

http://forums.epicgames.com/threads/977316-(21)-Rama-s-Blueprint-Node-Library-As-a-Plugin-For-You!-No-Code-Compile-Required?p=31719668&viewfull=1#post31719668

then I think the node you want is Trace For Objects

and then you can specify what types objects you care about your skel mesh component hitting

#Why No Overlap Events for Skel Meshes by default?

Cause constantly generating overlap events for multi-body skel meshes is most likely very costly to track for every single skel mesh all the time, again if anyone knows more about this let us know please

#Actor Hit Event

you could use the Actor-level hit event and check which component was registered as having received/done the hit

UFUNCTION(BlueprintImplementableEvent, meta=(FriendlyName = "Hit"))
virtual void ReceiveHit(class UPrimitiveComponent* MyComp, class AActor* Other, class UPrimitiveComponent* OtherComp, bool bSelfMoved, FVector HitLocation, FVector HitNormal, FVector NormalImpulse, const FHitResult& Hit);

#Accuracy

The actor-level hit is less accurate because it is done with the actor capsule, I think,

but depending on your game/MOVIE goals this might be plenty of accuracy!


#Larger Level Goals?

What are your larger level goals for which you need skel mesh component level hit detection?

I might be able to write a BP node for it, depending.

Heh, figures.

The method I previously used was to manually trace each tick as required :slight_smile:

The idea was to use the overlap events as a more accurate replacement.

What is frustrating is that you can enable collision, allowing you to push around physics based objects with skeletal meshes :expressionless:

I already have a work around, which is to attach a shape components in place of the physics asset shapes. This works fine, but is a kinda of silly requirement when the shapes already exist in the physics asset :frowning:

It will have to do until we hear back from Epic or I figure out a better way.

Kris

If there was a non-constant-tracing way to get accurate skel mesh component overlap events I would be quite interested to know about it!

Let’s see what others/Epic has to say :slight_smile:

I’ve opted to use extra shape components to determine overlap/touching.

It does require adding additional shape components, but has the side benefit of letting you size these to fit.

eg. Just the length of barrel that extends beyond the players collision component.

When ever an item is placed in-hand, I attach its viisble & overlap components to the players mesh.
I then have two choices:

  • Go through the character, filter out the item overlap component and then check for component overlaps.
  • Get the item to keep a pointer its own overlap component and just call a custom IsItemOverlapped() function (or similar).

I prefer the latter, though either way works.

Hey Rama and Christopher,

Thanks for sparking this discussion! Initially, we had decided that we were not going to support this feature because it is an expensive feature, but we have reviewed everything you guys have talked about in this thread and we are going to look into adding support for it.

Thanks!

-Steve

Wait, shouldn’t we be thanking you? :stuck_out_tongue:

I was looking at adding more shape components to the simulate the position of the players forearms. Being able to enable overlap events for the forearm physasset bodies would be much nicer :slight_smile:

Thanks!

“Wait, shouldn’t we be thanking you? :P”

Thanks Epic!

tyepicdevsheart.jpg

Rama