I’m pretty new to UE4 (I’m about a month in at the moment) and I’d like to ask if there are any kind of surfaceflags or something of that sort?
By surfaceflags, I mean some kind of indicator which tells you if you are on solid ground, on slippery ice or any other kind of surface. Or would I have to build this in on my own and if so; what would be a good approach?
Take a look at the ShooterGame example, specifically Source/ShooterGame/Effects/ShooterImpactEffect.cpp. There you will see the game code has mapped some #defines in ShooterTypes.h to various values in the EPhysicalSurface enum. You can give these enums names (like ice) in Projects Settings under Engine > Physics > Physical Surfaces. Once you do that, you can create Physic Material Assets which you can assign these surface types to.
Engine/EngineTypes.h:
/** Types of surfaces in the game. */
UENUM(BlueprintType)
enum EPhysicalSurface
{
SurfaceType_Default UMETA(DisplayName="Default"),
SurfaceType1 UMETA(Hidden),
SurfaceType2 UMETA(Hidden),
SurfaceType3 UMETA(Hidden),
...
What I was looking for was more of the physical altering surfaces though; like when you’re walking on ice you’re sliding et.c. Are any of these dynamics built into the engine?
If I was to force my character to slide on any surface, how would be best to go about it? I’ve tried setting the Friction to 0 but that doesn’t do it for me.
I’m not sure. Assuming you are using UCharacterMovementComponent, then maybe look at SetWalkableFloorAngle, CurrentFloor, and GroundFriction. GroundFriction, in particular, has the following note that sounds like what you’re trying to achieve: