Forum rules - please read before posting.

Jump sounds

edited September 2021 in Technical Q&A

AC includes a footstep sound component which is great for movement audio. Similary though, is there anything I can use to plug sounds into for jumping (i.e. a take off and landing sound)?

Thanks!

Comments

  • Not currently. I think this would best be handled officially by introducing an OnPlayerJump custom event that can be hooked into to provide whatever extra functionality is necessary.

    If your Player has an Animator though, you can define a "Jump bool" parameter that can be used to transition to an animation that triggers an animation event which involves audio playback.

  • edited September 2021

    Having some offical events like OnPlayerJump and OnPlayerLand would indeed be super-duper awesome.

  • I'm not sure about OnPlayerLand, but a hook into OnPlayerJump could listen out for the Player's IsGrounded state to become true from that point on.

  • Oh yes, that's much more sensible.

  • Oops - actually, there already is an OnPlayerJump event!

    It does not, however, get called when a Character Controller is involved. I shall fix this bug in the next release.

  • edited November 2021

    Hey Chris can I check this is still planned? I've just been looking at joystick rumble stuff, which is another thing that would plug in great with the CC event.

  • Yes, the fix will be included in v1.74.3.

  • Thank you.

  • edited November 2021

    Confirmed that the OnPlayerJump event is working fine with the CC. Thanks very much.

    For detecting if the player jumps, and becomes grounded, does this seem like a sensible setup or is there a better way to do it without Update()?

        private bool isJumping = false;
    
        void OnPlayerJump(Player player)
        {
            if (!isJumping)
            {
                isJumping = true;
                print("Jump!");
                // TODO: play jump sound
    
            } 
        }
    
        private void Update()
        {
            if (isJumping)
            {
                if (AC.KickStarter.player.IsGrounded())
                {
                    isJumping = false;
                    print("Grounded");
                    // TODO: play landing sound
    
                }
            }
        }
    
  • No, that should be fine. An Update loop for a lone character won't have an impact IMO.

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.