Forum rules - please read before posting.

Enable/Disable SlowNearWalls via script (custom action)

edited April 2021 in Technical Q&A

Hello Chris,
What's the correct way to toggle "SlowNearWalls" at runtime, via custom action?

My player uses the SlowNearWall feature (which slows the player down when near walls, doors, or anything that is using the specified walls layer), but i need to disable it when the player wants to interact with a door and expect to walk through.

This would prevent the character from sliding through a door when it should instead play a custom animation or a walk cycle.

I would then re-enable the feature once the character reached its destination.

Thanks!

Comments

  • Place the following script on a new GameObject, make it a prefab, and remove from the scene:

    using UnityEngine;
    
    public class ToggleWallSlowing : MonoBehaviour
    {
    
        public void EnableSlowingNearWalls ()
        {
            AC.KickStarter.player.doWallReduction = true;
        }
    
        public void DisableSlowingNearWalls ()
        {
            AC.KickStarter.player.doWallReduction = false;
        }
    
    }
    

    You can then use the Object: Call event Action to trigger this prefab's EnableSlowingNearWalls and DisableSlowingNearWalls functions to alter the option.

  • That worked, thanks Chris!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.