|
Post by tanoshimi2000 on Aug 15, 2021 20:23:23 GMT
OK, so I have more functionality than I have buttons. To get past this, I want to make a button perform differently based upon press, double press, and hold. For example, Jump = Press, Double Jump = double press, and Roll = hold. Also, Light Attack = Press and Heavy Attack = Hold.
I saw the ShooterMelee example and those are available in the vTriggerGenericAction class, but not in the vShooterMeleeInput class. Since Roll and Heavy Attack are already part of the vShooterMeleeInput I don't want to make them Generic Actions. Or is that what I have to do in order to add them?
|
|
|
Post by tanoshimi2000 on Aug 16, 2021 1:00:52 GMT
So after some digging through the code, I can see where vThirdPersonInput calls the protected virtual void JumpInput() routine, that listens for the Jump button. I also see, digging into that GenericInput class the GetDoubleButtonDown() function. I can change the RollInput() to look for the jumpInput.GetDoubleButtonDown bool, but it never gets triggered because the JumpInput catches the button press first.
Any ideas on how to listen for both ButtonDown and DoubleButtonDown on the same key and act differently? I feel as if, even if I set one routine to handle Roll and Jump, it will still not catch both.
Or is it simply not possible to catch DoubleButtonDown if ButtonDown is called first?
|
|
|
Post by tanoshimi2000 on Aug 16, 2021 16:09:39 GMT
So, if anyone else finds this while looking for combining two items on one button, I was able to make Jump the single press and Roll the Double Press by doing the following:
1. In vThirdPersonController I change the Jump function to look for GetButtonTimer(0.1f). 2. I changed the Roll function to look for JumpButton.GetDoubleButtonDown(). You can also set it to look for RollButton.GetDoubleButtonDown() and then set the Roll Button to the same button as the Jump. 3. In the actual Unity Properties window, I set Roll Button to the same value as Jump Button, but again that's optional.
If I had time, I'd rewrite the Controller to display the drop down for InputType for each input, and then track which one to look for, and then Just send the True command if those had been met. But I'm hacking and patching to get my project done. Maybe in a future build?
Also going to play with that value for GetButtonTimer, and get it as low as possible. I don't know how long you actually press for a double-tap, but I imagine it's probably about 0.01f - 0.05f, so I may be able to drop that 0.1f safely down to 0.075f.
|
|
|
Post by hazara on Jan 28, 2023 0:08:37 GMT
Hi, I want to add an item to the asset by push hold button, but it's only with the vTriggerGenericAction button.. Is it possible, is there a way to do this?I put the timeline fill but as soon as the button is pressed the item is added and that's not what I want
|
|