Movables Sound Component
In Class: MovablesSoundComponent
This Component is an Actor Component to designed to be attached to Actors that generate Sounds based on their physical movement. This includes standalone objects like a ball or components like drawers in cabinet.
Detecting Hit and Slide Movements
When one object hit another, we expect it to make some kind of hit sound, depending on their qualities (size, material, surface texture etc.) and the hit velocity. A special case is dragging an object across a surface. Although this causes repetitive hits, we don’t expect the Hit Sound to be played repetitively but a dedicated “slide sound”. To check wether a Hit Event from the simulation should trigger a Hit Sound or a Slide Sound, we can use the velocity vector of the hit component and compare it to to the Hit Normal Vector. When we slide across a surface, the velocity is perpendicular to the impact normal. Using acosd, you can convert the dot product to an angle, which can be easier to work with. Based on an Angle Threshold, you can decide whether a slide should be considered a slide.
Now that I’m writing it down, you could also make the Threshold depending on the velocity, resulting in slow movements to be more susceptible to “clonks”