I have a throwable VR sticky grenade. It uses a ProjectileMovementComponent for physics. I have it set up so that on bounce, if the object it hit is of collision type Pawn, it attaches to the object at the hit bone. The actual function looks like this:
void AProxyWarExplosive::OnBounce(const FHitResult& HitResult, const FVector& NormalImpulse) {
if (WeaponConfig.bSticksToPawns && HitResult.GetComponent()->GetCollisionObjectType() == ECollisionChannel::ECC_Pawn) {
MovementComp->StopMovementImmediately();
RotationComp->StopMovementImmediately();
AttachToComponent(HitResult.GetComponent(), FAttachmentTransformRules::KeepWorldTransform, HitResult.BoneName);
}
}
This works 100% fine. However, I’m now finding that it’s very natural when one of these things hits you to want to pull it off of your body. This also works just fine… on clients. Only on clients. On the server, picking up a grenade does not work when the grenade is attached to a player’s body.
Thinking this was surely my fault, I logged out all the picking up logic to debug. The pick up process is very simple, I just have a SphereComponent attached to the player’s hand and I use GetOverlappingActors like so:
TArray<AActor*> Overlapping;
GrabSphere->GetOverlappingActors(Overlapping, ClassFilter);
Where ClassFilter is the grenade base class. I then Iterate through the Overlapping array and return the nearest one to be picked up. What I’m finding in this particular situation is that these attached grenades do not show up in Overlapping list at all.
Here is a video of me doing some further testing with just a very basic skeletal mesh and a static mesh. No characters or anything involved to get in the way. As you can see, I can pull the grenade off the cube just fine, but when it’s attached to the skeletal mesh I cannot. Again, this behavior is ONLY on the server.
Why in the world would this be happening?
EDIT: I found today that this issue is actually not present in a packaged build. Truly baffling