How to use directional based revives?

zoicelols

Member
I have my character knocked down laying on the ground and I am trying to use a subclassed revive script to control the ability int data and set it based on directional input use. Right now I am just able to revive one way.

I'm trying to make a way to revive forward, right, backward and left based on holding or pressing a direction (w,a,s,d) .

I don't know how to pull from the playerinput class to allow this if possible
 

Andrew

Moderator
Staff member
You can simply use UnityInput.GetAxisRaw to check if the player is passing a directional input. UnityInput also has all the expected methods like GetButtonDown.
C#:
using Opsive.UltimateCharacterController.Input;

...

{
    UnityInput input = GetComponent<UnityInput>();
    float horizontal = input.GetAxisRaw("Horizontal");
    float vertical = input.GetAxisRaw("Vertical");
    Debug.Log($"{horizontal}, {vertical}");
}
 

zoicelols

Member
I'm not sure how to set this up to return ability int data based on what you have shown me. I tried variations of information from this in an if statement, but i get red errors.
 
Last edited:

Justin

Administrator
Staff member
Do you have the Agility Pack? The dodge ability will play a different animation based on the input. It does this by setting multiple input names and then grabbing the InputIndex within the start of the ability.
 

zoicelols

Member
I do have the agility pack. So am I capable of pulling code references from it to use with my custom revive class? Or are you saying i should use dodge instead of revive for directional "get back up" animations?

Right now I'm actually already using dodge for a 4 directional dodge based on input.

Did you mean copy from the dodge ability the part that makes the dodge ability play animation based off input and paste it into my subclassed revive? or did you mean subclass and create a new dodge ability and use it as my new revive since it fits my purpose?
 
Last edited:

Andrew

Moderator
Staff member
Either approach sounds reasonable, but for your use case it would probably make sense to stick to using the revive ability and just use the dodge ability to give you an idea for how to carry out what Justin suggested.
 
Top