1 Year Ago
Scrape Effects (#1139) * Add props to Surface for impact decal and scrape effects / decals * Use ContactPoint + SurfaceNormal to pass into AddImpactSound * Let's add decals and particle effects for impacts but try only doing it if speed > 30 - maybe we configure this per surface? * Add PhysicsImpact struct and use that to seperate effects for Hard and Soft impacts in Surface description (decals + fx) * Correctly spawn soft or hard physics impact particles + decals based on squared speed * Add normal from first valid manifold on contact to friction events to pass to C# * Enable/Disable physics impacts and scrape events as props for now, pass normal from fiction event to AddFrictionSound and create effects where necessary * Also grab contact center from first manifold and pass to C# * Use contact pos for decals + effects, try to base effect frequency on energy volume scale, fix decal placement remove particles on friction effect stop * Set destroy time to 0.5 (this is a failsafe anyway) * Don't have particles follow entity, do it ourselves so we can set to actual contact pos * Set forward for scrape particles to contact normal * Use method for getting inherited surface values if necessary to avoid repeating same code * Add Mass and Direction named control points for friction particles. Mass is body mass, direction is body velocity normal. CP0 is already setting position and contact normal * Lower destroy time for effects * Reorganize scrape data in surface def, lower default values. Don't fallback to rough by default. If it's a smooth scrape and there's no effects for that - do nothing by default * Surface is considered smooth by default, can set roughness factor higher for rough surfaces... * Get material for triangle by index for shape 2 on friction events should fix all friction events against world surfaces having hit surface be "default" * Store friction hit surface (last) and if we've changed hit surface stop any previous effects and sounds * Remove unused prop * Remove unused var * Make EnableScrapeEffects and EnableImpactEffects internal for now * Make FrictionEffects a dictionary * Call PhysicsGameSystem.Shutdown on GameLoop shutdown to ensure vars cleared * Add an Intensity named control point value (0-1) for scrape particle effects to use