docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IGravityController

    Interface for external control over the GravityProvider. This interface should be implemented from a LocomotionProvider and be parented or attached to a LocomotionMediator.

    Namespace: UnityEngine.XR.Interaction.Toolkit.Locomotion.Gravity
    Assembly: Unity.XR.Interaction.Toolkit.dll
    Syntax
    public interface IGravityController

    Properties

    canProcess

    Whether the gravity can be processed. Gravity controllers that can process receive queries to gravityPaused, controllers that cannot process do not.

    Declaration
    bool canProcess { get; }
    Property Value
    Type Description
    bool
    Remarks

    It's recommended to return isActiveAndEnabled when implementing this interface in a MonoBehaviour.

    gravityPaused

    Whether gravity is paused.

    Declaration
    bool gravityPaused { get; }
    Property Value
    Type Description
    bool
    See Also
    IsGravityBlocked()

    Methods

    OnGravityLockChanged(GravityOverride)

    Called from TryLockGravity(IGravityController, GravityOverride) when gravity lock is changed.

    Declaration
    void OnGravityLockChanged(GravityOverride gravityOverride)
    Parameters
    Type Name Description
    GravityOverride gravityOverride

    The GravityOverride to apply.

    See Also
    onGravityLockChanged

    OnGroundedChanged(bool)

    Called from GravityProvider when the grounded state changes.

    Declaration
    void OnGroundedChanged(bool isGrounded)
    Parameters
    Type Name Description
    bool isGrounded

    Whether the player is on the ground.

    See Also
    onGroundedChanged

    RemoveGravityLock()

    Removes this provider from the GravityProvider list's of locked providers.

    Declaration
    void RemoveGravityLock()

    TryLockGravity(GravityOverride)

    Attempts to lock gravity.

    Declaration
    bool TryLockGravity(GravityOverride gravityOverride)
    Parameters
    Type Name Description
    GravityOverride gravityOverride

    The GravityOverride to apply.

    Returns
    Type Description
    bool

    Whether the gravity was successfully locked.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)