I am trying to accomplish drop sounds for weapons hitting the ground or flying from an explosion and hitting a wall.
My naive approach would be to just add some code to the weapon actors OnTick to detect when they’ve exceeded a certain ceiling speed and then when they’ve come back down under a floor speed assume they’ve stopped and play a sound.
I was thinking a better approach would be to detect collisions and try to gauge the magnitude of them and play a sound accordingly. Might anyone suggest where I could hook in to listen for hit events like this on an actor?
I use the ReceiveHit event on my pawn and call a method passing along the NormalImpulse vector parameter. The length of that vector basically tells you how hard the impact was. Something like this:
Ah thanks very much for that. I’ve overriden the ReceiveHit event on my weaponDrop actor yet I am not finding that drops to the floor are triggering ReceiveHit. Is there something I am missing?
edit: Ah nevermind I found out i had to set WeaponMesh->SetNotifyRigidBodyCollision(true);
Ah thanks very much for that. I’ve overriden the ReceiveHit event on my weaponDrop actor yet I am not finding that drops to the floor are triggering ReceiveHit. Is there something I am missing?
edit: Ah nevermind I found out i had to set WeaponMesh->SetNotifyRigidBodyCollision(true);
[/QUOTE]
Oh yeah, that is the equivalent of setting “Simulate Physics” on a Blueprint component. Without that it just won’t use any physics at all.