Skip to content

There is an error in the physical material update function #61

@LuciferTC9527

Description

@LuciferTC9527

The current physics material update function UpdateSurfaceFriction has a bug that incorrectly applies the previous material.

Temporary fix,Replace the previous UpdateSurfaceFriction function:

void UPBPlayerMovement::UpdateSurfaceFriction(bool bIsSliding)
{
        if (!IsFalling() && CurrentFloor.IsWalkableFloor())
        {
            bSlidingInAir = false;
            FHitResult Hit;
            TraceCharacterFloor(Hit);
            float NewSurfaceFriction = GetFrictionFromHit(Hit);
            
            if (!FMath::IsNearlyEqual(SurfaceFriction, NewSurfaceFriction, 0.01f))
            {
                SurfaceFriction = NewSurfaceFriction;
                OldBase = CurrentFloor.HitResult.GetComponent();
            }
        }
	else
	{
		bSlidingInAir = bIsSliding;
		const bool bPlayerControlsMovedVertically = IsOnLadder() || Velocity.Z > JumpVelocity || Velocity.Z <= 0.0f || bCheatFlying;
		if (bPlayerControlsMovedVertically)
		{
			SurfaceFriction = 1.0f;
		}
		else if (bIsSliding)
		{
			SurfaceFriction = 0.25f;
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions