Freeze Player in Air (Ground Pound Ability)

RobbieNI

Member
Hey there,

I'm trying to create a ground pound ability, it gets activated when the player jumps (is airborne) and the player holds the crouch button. Whilst the crouch button is being held I want to the player to just freeze in the air, then when the button is released they will pound toward the ground.

I have this set up as two separate abilities (the in air freeze and the pound toward the ground). Everything is working as it should however I can't for the life of me get the player to freeze whilst in the air. I think it has something to do with the previous force from the jump or fall still being applied when this ability is active.

I have set the in air freeze ability to not use gravity, and block the fall ability from starting. I have also tried to update the position of the character with the UpdatePosition() override, however none of this seems to have any effect.

Is there a particular method or physics check I need to use to do this? I can't seem to find anything on the docs other than disabling gravity.

Any help would be appreciated.

Cheers,
Robbie.
 
Have you tried disabling Use Gravity on the character itself? Also you may want to forcefully set the CharacterLocomotion.Velocity to Vector3.zero.
 
If you call UltimateCharacterLocomotion.ResetRotationPosition() it'll completely reset all of the movement variables. My guess is that the MotorThrottle, MoveDirection, or ExternalForce variable is still contributing to the motion.
 
If the character is still falling it sounds like gravity is enabled. Do you have the swimming pack? The swim ability provides a good example of disabling gravity and floating in the air (or, in this case, the water).
 
I only have the agility pack, so I'd not be able to check out how the swimming ability works. This is what the locomotion component looks like in play mode when the ability is active, and as you can see gravity seems to be disabled. I've stepped through the code with breakpoints and it also shows that gravity is disabled. Note that I've disabled it through code and in the abilities general settings section.
 

Attachments

  • Snip.PNG
    Snip.PNG
    70.1 KB · Views: 4
What's that "Prevent Fall Ability" parameter doing exactly? Disabling "Use Gravity" definitely works in the demo scene, so I wonder if there's something in your ground pound ability that's causing this for some reason. Are you able to share the script/s? (Feel free to do so in DM if you don't want to share your code publicly)
 
I initially thought the fall ability would impact this ability (e.g. I don't want the character to fall when this ability is active) that's why I prevent it from starting with that parameter. Disabling gravity before I jump works fine in my scene, so I assume. it's something to do with the jump force but using the reset position and rotation method has no effect.

I don't mind sharing the code at all, I'll attach the GroundoundStart script (which is what I'm having the issue with) and also the CrouchProneInput script (which is what I'm using to call the ability (at line 135)) in case there's something in there that I'm doing wrong.
 

Attachments

  • CrouchProneInput.cs
    6.9 KB · Views: 6
  • GroundPoundStart.cs
    2.3 KB · Views: 4
I don't see anything wrong with your scripts. After some more testing, it seems that disabling "Use Gravity" on the character before or during the jump works fine, but disabling it after they've started falling seems not to change their velocity at all, even after setting Velocity to zero and calling
ResetRotationPosition().

Unless I'm missing something, this is a possible bug? @Justin
 
I just checked and ResetRotationPosition doesn't reset the gravity amount. You should also do this call:

Code:
m_CharacterLocomotion.GravityAmount = 0;

By disabling UseGravity it stops the gravity from accumulating but it doesn't reset it.
 
Top