Player Mesh and Weapon and Game Events, How to?

Hello I have been reading docs and am trying to figure out how weapons.
Are attached to the players mesh, do anyone have any pointers regarding this?
What am trying to do is just to make a weapon attach to the correct bones.
From reading docs am wondering if this could be USceneComponent:: or USkeletalMeshComponent:: but not sure.

Also am having a hard time figuring out how to catch and send game events.

If anyone have some pointers it be great help.

Did you look at the shooterGame template? It should have the code there already.

If that’s not enough you will want to look at UDK docs which is much more plentiful. I believe in the end, you will end up creating a socket in the editor on a bone. In code, from a USkelealMeshSocket you could attach the Weapon

bool USkeletalMeshSocket::AttachActor(AActor* Actor, class USkeletalMeshComponent* SkelComp) const

That would be my guess.

[edit] Took a peek at ShooterGame

void AShooterWeapon::AttachMeshToPawn()
	if (MyPawn)
		// Remove and hide both first and third person meshes

		// For locally controller players we attach both weapons and let the bOnlyOwnerSee, bOwnerNoSee flags deal with visibility.
		FName AttachPoint = MyPawn->GetWeaponAttachPoint();
		if( MyPawn->IsLocallyControlled() == true )
			USkeletalMeshComponent* PawnMesh1p = MyPawn->GetSpecifcPawnMesh(true);
			USkeletalMeshComponent* PawnMesh3p = MyPawn->GetSpecifcPawnMesh(false);
			Mesh1P->SetHiddenInGame( false );
			Mesh3P->SetHiddenInGame( false );
			Mesh1P->AttachTo(PawnMesh1p, AttachPoint);
			Mesh3P->AttachTo(PawnMesh3p, AttachPoint);
			USkeletalMeshComponent* UseWeaponMesh = GetWeaponMesh();
			USkeletalMeshComponent* UsePawnMesh = MyPawn->GetPawnMesh();
			UseWeaponMesh->AttachTo(UsePawnMesh, AttachPoint);	
			UseWeaponMesh->SetHiddenInGame( false );

Ok thank you.
Regarding the game events are there some type of event listeners in UE 4?

We don’t have a ‘broadcast’ mechanism, but we do have delegates that you can bind to. You can create your own, or we have them already on actor and primitivecomponent for events like hit, overlap etc.

Hello thanks for the reply I have been looking at docs and the shooter example and I found this.

virtual void NotifyKilled(AController* Killer, AController* KilledPlayer, APawn* KilledPawn, const UDamageType* DamageType);
virtual void InstigatedAnyDamage(float Damage, const class UDamageType* DamageType, class AActor* DamagedActor, class AActor* DamageCauser);

The first to comes to mind is where are they called from?
Also have not been able to find any method named Hit(…).

In the documentation for InstigatedAnyDamage(…) in the source example shows a Broadcast() method.
I have not yet been able to research this yet UE 4 is some what overwhelming at times :slight_smile:

Are there any examples for this a entry level task of sorts to get me started?
Thanks for any help.

Try tossing in some breakpoints when those functions get called and examine the call stack

Yes I was just thinking that this was documented somewhere.
So I did not have to “Reverse Engineer” the system.

Seems like something that would be documented, or there be a tutorial on.
Thanks for any help.

The easiest way to get events in you Actor is just to override functions like ReceiveHit and ReceiveActorBeginOverlap.