⮞ Go to NeoFPS.com

    Show / Hide Table of Contents

    Surfaces

    Overview

    The NeoFPS surfaces system is an in-development system for querying impact surface materials. It is used in a number of places in the NeoFPS framework, including Footsteps and Bullet Hit Effects.

    Surface Manager

    The SurfaceManager scriptable object is located in the NeoFPS/Resources folder, and accessible through the NeoFPS hub. The surface manager associates specific surfaces with effects and audio clips for use in bullet hits, etc. You can also place a SurfaceFxOverrides behaviour in the scene in order to override the surface effects on a scene by scene basis.

    Adding New Surface Types

    The Surface identifier is a generated constant that lists the available surfaces in the game. Adding new surfaces is as simple as editing the ConstantsSettings and regenerating the constant. Keep in mind that in the inspector generated constants are stored by index. This means that reordering or removing existing surfaces will not be correctly picked up in inspector properties. This means that it is best to try and decide on the available surfaces early in a project if possible.

    Once you have added new surface types, you can then access these when assigning audio clips in the SurfaceAudioData assets used for things like footstep and bullet hit audio, and the SurfaceHitFxData asset used to specify impact visual effects among others.

    Surface Behaviours

    Surface behaviours (currently just SimpleSurface) are attached to physics objects that need a surface ID such as environment or prop colliders. This means that if the object is shot, hit or stepped on the surface behaviour will tell the relevant system the surface they need to react to with audio or graphics effects.

    New surface behaviours will be added in future updates.

    Adding New Bullet Hit VFX

    The SurfaceManager holds a reference to the SurfaceHitFxData asset that specifies all the bullet hit VFX for different surface types. This is currently shared for all bullet and melee impacts, but the future you will be able to specify separate hit FX data for different attack types. The architecture of this has not been decided yet.

    Each of the entries in the SurfaceHitFxData asset references a prefab with a component that implements the BaseHitFxBehaviour base class. The demos all use the ParticleSystemHitFxBehaviour which works by moving a group of particle systems to align with the hit point, and calling Emit() on them. This means that all of the particles per surface type reuse the same particle systems instead of having hundreds of separate systems all working at once. Another option that helps when replacing the impact FX with other assets is the PooledObjectHitFxBehaviour. This uses the pooling system to recycle objects for efficiency. This can be combined with the ParticleSystemPlayOnEnable component to trigger particle systems each time a pooled object is activated.

    You can also implement your own FX by writing a script with a class that inherits from the BaseHitFxBehaviour base class.


    See Also

    SurfaceManager

    SimpleSurface

    Back to top Copyright © 2019 Yondernauts Game Studios Ltd
    Generated with DocFX