Forum rules - please read before posting.

Constrain gravity for NPC

Hi Chris,

In AC, there is action to enable the gravity on and off for player in runtime.
However, I can't find one action can do it for NPC in runtime.
Is there any way to enable or disable gravity for NPC character in runtime? Thanks

Comments

  • Paste the following inside a new C# script class:

    public void IgnoreGravity ()
    {
        GetComponent <NPC>().ignoreGravity = true;
    }
    
    public void UseGravity ()
    {
        GetComponent <NPC>().ignoreGravity = false;
    }
    

    Attach it to your NPC, and then you have two functions "IgnoreGravity" and "UseGravity" that can be run to toggle gravity. You can trigger these functions with the Object: Call event and Object: Send message Actions.

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.