Forum rules - please read before posting.

"Check player grounded" action

Is there a way within an actionlist to check if the player is ground? I couldn't find an action that does this but before I try to figure out if I can store "player grounded" as a global/local variable I thought maybe somebody here has a better solution?

Comments

  • edited April 2020

    The Char script's IsGrounded can be read to determine this - though exactly how this is calculated depends on what components they rely on.

    Here is a custom Action, **Player: Check grounded, that reads this:

    namespace AC
    {
    
        [System.Serializable]
        public class ActionCheckPlayerGrounded : ActionCheck
        {
    
            public ActionCheckPlayerGrounded ()
            {
                this.isDisplayed = true;
                category = ActionCategory.Player;
                title = "Check grounded";
            }
    
    
            public override bool CheckCondition ()
            {
                return KickStarter.player.IsGrounded ();
            }
    
        }
    
    }
    

    Just place it in a file named ActionCheckPlayerGrounded.cs and follow the tutorial instructions above to install it, and it should be good to go.

  • Thank you Chris, this works purrrrrfect!!!

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.