Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Assets Third Person Templates by Invector

Discussion in 'Works In Progress' started by Invector, Aug 20, 2015.

  1. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Totally agree! I've been looking for a melee system like this for a very long time. While some have come close, none have been as nearly as complete as this one.
     
    Invector, jgiroux and Vibhanshu like this.
  2. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I noticed that when using one of the push/pull boxes, hitting the sprint key causes the player to lose stamina even though they are not actually sprinting.
     
    Invector likes this.
  3. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    I have a question. Im hoping I can get better understanding.
    I have set up a series of strung together attacks.
    what I seem to notice is after about 3-4 or more in a series, my character will kind of glide in the direction I am pressing movement wise as the animations are playing.
    meaning, rather than staying in place if I trigger a attack animation I start to be able to move around (gliding) as the animation continues to play. after it finishes (animation) it triggers the end/full body transition and all is well again.

    I looked at tutorials and how you adjusted time for replacing an animation, but these are just new attacks added to the original 3 to give more variety.

    you can see what I mean in the example below, pick up the sword, go into strafe mode and click attack while moving left or right however you wish (to trigger different attacks) and you will notice better what I mean.
    in the example below,after grabbing the sword, just hold the right joystick or D on keyboard and keep clicking the attack. you will start to just slide to the right.

    any insight?

    https://dl.dropboxusercontent.com/s/byv5quqsj6x6lol/combotest.html


    Btw: Overlord model and animations from Mixamo sword and shield and axe pack are free
     
    Last edited: Jun 9, 2016
  4. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    Good to know! thanks!

    Open your ThirdPersonMotor script, find the StrafeMovement method and add the following line:
    if (inAttack) return;
    the FreeMovement already has it, so probably by adding this verification on the strafe it will fix the issue ;)
     
  5. Vibhanshu

    Vibhanshu

    Joined:
    Aug 7, 2014
    Posts:
    24
    Yeah that's right ..... Shooters are somewhat easy to develop but melee combat ...oh man...the chaining of combos, hit detection, ai behavior etc., much, much harder than shooting system
     
  6. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22

    Thank you for the quick answer! and indeed that helped me fix my issue.

    also, on my controller component I am using root motion(forgot I decided on using that) and accidentally had extra strafe set to .4 from previous testing...instead of 0. changing that solved the issue entirely for anyone else running into same thing.
     
    Invector likes this.
  7. snackzilla

    snackzilla

    Joined:
    Aug 17, 2014
    Posts:
    91
    Ah I'm sorry guys! I've been on (and still am on) Vactation! (Disney World, yeah!) Anyway, the jumpEvade for the demo video you see is actually another Jump. I called it StrafeJumps. It's a totally separate animation state in Actions, and it checks to see if the character is in Strafe, then changes the Jump Animation to evade forward, backward, left, and right, depending on the direction you're holding. :) I'll do a detailed write up of this, and the integration so far with plyGame when I get back around the 14th.
     
  8. HR0THVITNIR

    HR0THVITNIR

    Joined:
    Nov 21, 2013
    Posts:
    24
    I would like to make a suggestion/request regarding your upcoming shooter framework.
    Just add a camera 'aim' mode (like strafe mode now, but no lock-on) for guns, with the appropriate code and animator variable for turning/adjusting the player body feet to match look direction (right now if I set up first person with a second camera, ik look rotation breaks and snaps back to zero rotation for the upper body if you look too far right or left; instead the upper body should keep aiming, but the feet should play a step animation, and the body/root/controller should rotate).
    Making the current camera capable of first person, or whatever you were referring to that you have planned, would be nice too - but not immediately necessary (we can easily add a camera ourselves if we want while we wait for future updates).
    Release just that. You can label it a beta if you want. I'd buy it. It would let us play around and work on our games without having to wait a long time for a polished release of your full shooter project with all the extras you might decide to include that people might want to replace with their own ideas anyway (like the weapon handling system, projectiles, AI, etc).
     
  9. rbm123

    rbm123

    Joined:
    May 24, 2015
    Posts:
    125
    you are my hero!
     
    Invector likes this.
  10. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Is there a guide somewhere for using FinalIK with this? I went back quite a bit in this thread and found a lot of scattered information but nothing specific and some of it is probably outdated. I'm trying to use the Grounder and when I put it on the player, the player flies into the air when play is started but then works fine until ragdoll. I'm sure I can flounder around in the code and figure out how to fix these problems myself, but if there is instructions somewhere I'm not seeing, that would be much better than my guesswork.
    Thanks!
     
    Last edited: Jun 10, 2016
  11. bakayoyo

    bakayoyo

    Joined:
    Jun 10, 2016
    Posts:
    2
    Hi, I've also experienced crashes upon closing Unity 5.3.5f1. I've narrowed it down to the CombatController.controller file in the 3DModels/Mecanim directory. If I remove it the crashes do not occur anymore.

    edit: there seems to be a conflict with ThirdPersonAnimatorController.controller from the Standard Assets. If I remove that the crash doesn't happen anymore.
     
    Last edited: Jun 10, 2016
  12. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    To create a aim mode for the camera is very simple, you just need to crate a new CameraState with the settings you want (over the sholders for example) and trigger this new state at the ControlCameraState method at the ThirdPersonController. And to make the character rotate with the camera, just remove the strafe condition at the method RotateWithCamera on the ThirdPersonMotor. This will allow the character to rotate as ou move left/right with the camera, we will try to add step animations to looks better.

    It's super easy to add the footIK from FinalIK, I will write a tutorial and post here.

    Hmmm if you backup this file and add later you still get the crash? you will definitelly need this file in order to the template work correctly.
     
  13. bakayoyo

    bakayoyo

    Joined:
    Jun 10, 2016
    Posts:
    2
    Yes, it happens consistently if the Standard Assets ThirdPersonAnimatorController.controller is part of the project. Fortunately I don't need that in my project, so I can leave that out and keep CombatController enabled now.
     
  14. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I sent a crash report and got a reply that it was fixed and would be in the next update. I also found that saving the scene and the project then exit from the menu (not the little X in the upper right) it doesn't crash as often.

    Foot IK... I see was trying to use the grounder! And that requires the full body IK. Thanks! I'll try that.
     
  15. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    Here you go, fast & simple integration :p

     
    kurotatsu, kidling and drewradley like this.
  16. Roughrider

    Roughrider

    Joined:
    Jul 17, 2011
    Posts:
    71
    Anyone have a quick and dirty function/script that can be attached to the player/enemy that can populate a GameObject = playerHeldWeapon/enemyHeldWeapon? It would be an EXTREMELY useful snippet for everyone, and super appreciated! (Unless of course you provide the snippet in js, in which case we can't be friends anymore...) :)
     
    AshyB likes this.
  17. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Could you explain a little more what you want? I'm not sure I understand. Are you looking for a way to spawn weapons on the player/AI? I've written a script that allows me to change weapons from an inventory system (Okashi Framework).
     
  18. Roughrider

    Roughrider

    Joined:
    Jul 17, 2011
    Posts:
    71
    Kind of. I have a script attached to my player which contains a bunch of stats, including a public GameObject called "heldPlayerWeapon" it basically lets me drag in weapons from my scene which have stats attached to them to be readable by my combat system. (its the weapon the player has) What I need is to be able to populate that field with whatever the invector melee equipment manager has in its weapon hand (pickup)
     
  19. HR0THVITNIR

    HR0THVITNIR

    Joined:
    Nov 21, 2013
    Posts:
    24
    That's not what I meant sorry. Doing so means the locomotion in free directional mode will be locked to camera forward direction - you will get unwanted behavior if you press A,S or D because the animator isn't expecting this.

    Hopefully it is ok to post my band-aid solution - it isn't perfect, there is some jitter, but it might help people just looking for testing/developing their own projects while waiting for your shooter add-on.

    {
    1. In the Animator, add a float parameter "StrafeAngle"
    2. Add a new override layer just below Base Layer (call it whatever, I named mine shuffle_feet).
    3. Create a new body mask, name it lowerbody (or whatever), assign it to shuffle_feet layer. Deactivate everything but the legs/leg IK and torso(optional).
    4. Add an empty state to shuffle_feet.
    5. Then drag in "TurnOnSpotLeftA" and "TurnOnSpotRightA" to create two more states (from Invector/3DModels/Animations/_BaseAvatar/DefaultAvatar@TurnOnSpot).
    6. Make transition links from the empty "New State" to both "Turn..." animation states.
    7. In the transition to the animation states deselect Has Exit Time and Fixed Duration, and add six conditions.
    8. first: set Strafing True.
    9. next two: Direction Greater than -0.1 AND Direction Less than 0.1
    10. next two do the same for Speed as you did with Direction.
    11. For the last condition, make StrafeAngle Greater than 30 for "TurnOnSpotLeftA" ; Less than -30 for "TurnOnSpotRightA"
    12. In ThirdPersonMotor script, RotateWithCamera(), leave strafing alone, instead after the first "else" (line 827 for me) comment out the rest of the line: else//if(input!=Vector2.zero)
    13. Line 833 and 834 begin with "if(diferenceRotation < 0" and "else if((diferenceRotation > 0" change the first zero to -30 and the second zero to 30
    14. In ThirdPersonAnimator script, after line 657 or 658 (shouldn't matter) add animator.SetFloat("StrafeAngle", ang);
    15. On the player GameObject, ThirdPersonController under "Head Track & IK" change Max Angle to 60. I also changes Strafe Body Weight to 1.
    16. Set up your strafe camera as you wish.
    17. Start the 3rd person demo, and go into strafe mode when you won't lock on to anything. If you stand still and rotate the mouse, the feet should move and the player should follow the camera look direction through 360 degrees. Should just be able to put aiming animations in, plus maybe some IK on the hands. Good luck.
    }
     
    Last edited: Jun 11, 2016
    Invector, Kenaz and xxhaissamxx like this.
  20. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Cover system please, pretty please...
     
    Josalv, AshyB and HR0THVITNIR like this.
  21. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Most of the variables in the Hit Box, Melee Controller and Character Controller are public so all you need to do is get a reference to that script and then you can just change the variables on them quite easily. Here is the code I am using. It's not exactly what you are looking for since I'm not changing anything but the weapon. Still, it should give you some idea how to proceed. It's attached to the same GO as the HitBox script.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class MeleeWeaponController : MonoBehaviour {
    5.     public vMeleeManager myvMeleeManager;
    6.     public vMeleeWeapon currentMeleeWeaponRA;
    7.     // Use this for initialization
    8.     void OnEnable() {
    9.         myvMeleeManager = GetComponentInParent<vMeleeManager>();
    10.         if (myvMeleeManager != null) myvMeleeManager.InitCustomMeleeWeapon();
    11.     }
    12.  
    13.     // Update is called once per frame
    14.     void Update () {
    15.         if (myvMeleeManager == null)
    16.         {
    17.             myvMeleeManager = GetComponentInParent<vMeleeManager>();
    18.             if (myvMeleeManager != null) myvMeleeManager.InitCustomMeleeWeapon();
    19.          
    20.         }
    21.         if(myvMeleeManager!=null)
    22.         {
    23.             if(myvMeleeManager.currentMeleeWeaponRA!=currentMeleeWeaponRA) myvMeleeManager.InitCustomMeleeWeapon();
    24.         }
    25.     }
    26. }
    27.  
    With this I can change any public variable on the melee manager with "myvMeleeManager.PublicVariableToChangeNameHere". Hope that helps you get started!
     
    Last edited: Jun 11, 2016
    Invector likes this.
  22. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Here is what I have on my armor to change the stamina and health of the player. It might be a little closer to what you are looking for. I had to make the "currentStamina" variable public but the rest of them are already public.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. using Invector.CharacterController;
    5. public class ArmorControl : MonoBehaviour {
    6.     public vThirdPersonController myController;
    7.     public int HealthBonus;
    8.     public int StaminaBonus;
    9.     // Use this for initialization
    10.     void Start () {
    11.  
    12.     }
    13.  
    14.     // Update is called once per frame
    15.     void Update () {
    16.         if (myController == null)
    17.         {
    18.             myController = GetComponentInParent<vThirdPersonController>();
    19.             if (myController != null)
    20.             {
    21.                 myController.maxHealth += HealthBonus;
    22.                 myController.currentHealth += HealthBonus;
    23.                 myController.maxStamina += StaminaBonus;
    24.                 myController.currentStamina += StaminaBonus;
    25.             }
    26.         }
    27.     }
    28. }
    29.  
    The key to this one is "using Invector.CharacterController;" which allows you to have access to the character controller.
     
    Invector and kidling like this.
  23. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    My codesigner had a question on the LockOn component. He rather likes using it but would like to also be able to rotate the camera at will but currently the camera becomes fixed and unmovable in a almost semi top down view

    I took a quick look at the scripting. But didn't see a possible way to allow movement of the camera as it appear it utilizes the face target to position the player always facing. Is that correct.? Or would it be possible to unlock
    The camera during lock on.?
    And allow the free movement of camera
     
  24. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    How nice to see everyone helping each other and sharing scripts :D
    @HR0THVITNIR thanks! I will take a look at our solution

    You can enable the free movement by commenting the line 130 at the SetTargetLockOn method, on the v3rdPersonCamera, but... it kind of lose the point of the 'lock' on target I guess lol
     
  25. AshyB

    AshyB

    Joined:
    Aug 9, 2012
    Posts:
    160
    @Invector any news on the release date of the shooter template? ;) i'm already sold. Just waiting....
     
    Pregga likes this.
  26. TripleSmash

    TripleSmash

    Joined:
    Mar 19, 2016
    Posts:
    10
    Had issue, just fixed it myself :p great asset!
     
    Last edited: Jun 12, 2016
  27. Chesnakov

    Chesnakov

    Joined:
    Aug 14, 2015
    Posts:
    3
    Hi! Why enemies walk on the air?
    2016-06-12 (1).png
     
  28. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    Thank you for the response, however I think I may have been unclear. But I was able to adjust it the way he wanted and I will explain it here for others that may wish for the same thing.

    The current way it seems your LockOn works is two ways.
    A) camera locks and faces always toward the enemy (no player camera movement available - you have it now currently set up that on a joystick (our preferred method of input) the right analog stick (normally used to rotate the camera around) when moved now changes your current Lock On target.
    B) Character is locked towards the target enemy *always* facing him, so that even during a complicated attack animation the player would continue to face in the enemies directions even while playing the animation (this is what we wanted to keep)

    if we turned the LockOn off or removed it, we were able to freely adjust the camera as we were strafing/attacking. *however* during some of the longer attack animations, the animation would force the player to continue in the direction that the player was facing when launching the starting attack sequence...which made our attacks seem kinda off...and didn't feel *right*.

    if we turned the LockOn component *ON* we would then be able to launch all of these super cool combo moves and the player would continue to face the enemy as it moved around, making the intricate attacks by the player seem smooth and felt oh sooo soooo *right* :)
    however our camera would be locked and often it kind of always went into an overhead view and stayed that way (and for us we wanted to be able to rotate the camera around to get all these wonderful close up shot and action views of our player character tearing into an enemy.


    so we had just wanted to re-enable the camera movement while keeping the LockOn method of forcing the player to face the current target.

    so this is what I did to allow that.

    in V3rd Person Camera script:

    in your
    public void RotateCamera(float x, float y) {

    I just commented out these lines:
    // Rotação livre de camera
    // if (lockTarget)
    // {
    //CalculeLockOnPoint();
    // }
    // else
    // {

    and at the end of that public void remember to also comment out an extra
    //}
    for the else statement above.

    we are currently using a highlighter system to show the selected current target so we didn't need a lock on point calculated and didn't want our camera locked during combat with a LockOnsystem in place.

    Hope this helps anyone else that would like a similar camera\/lock on state.

    and again, this has been the most fun I have had playing with an Asset in years.
     
    Pregga likes this.
  29. Pregga

    Pregga

    Joined:
    Jun 11, 2016
    Posts:
    3
    I have gone through many kinds of player controller and AI systems and this is by far the best one I have seen. Everything is cleanly programmed and highly modular, which is really nice. Really, I have just never seen such a polished and responsive third person controller and weapon system. Invector, I saw you say the AI were not very important, but I think you guys did a fantastic job with it. I can't wait to see your shooter implementation in this system. Will it be a separate add-on from melee? Also, will it play nice with the melee combat system?
     
    Invector likes this.
  30. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Navmeshes tend to be elevated off the geometry a little bit. You can adjust that quite easily.
     
    Chesnakov likes this.
  31. Chesnakov

    Chesnakov

    Joined:
    Aug 14, 2015
    Posts:
    3
    Thank you!
     
  32. xxhaissamxx

    xxhaissamxx

    Joined:
    Jan 12, 2015
    Posts:
    131
    can u tell me how please thanks
     
  33. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Adjusting the base offset is the most direct way. You can also bake the nav mesh, then move all the geometry up slightly (Just remember to move it down before you need to bake again!). There's probably better ways, but I've never encountered problems doing either one. I imagine various IK solutions would also work (such as Final IK), but I haven't tried that either.
     
    xxhaissamxx likes this.
  34. Roughrider

    Roughrider

    Joined:
    Jul 17, 2011
    Posts:
    71
    Anyone have a full size look at this, I think this may help more than my explanation. I'm stuck...
     
  35. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Will there just be one weapon in the hand ? If so:
    Code (CSharp):
    1. playerHeldWeapon=GetCompententInChildren<vCollectableMelee>().GameObject;
    NOT TESTED.
     
  36. Gojira96

    Gojira96

    Joined:
    Jun 18, 2015
    Posts:
    31
    Hi again.

    Two things:

    1.When testing,if I use any of the lower quality settings like „Fastest“ or „Fast“ the sprint depletes very quickly,making me run for less than a second before running out of stamina.

    2.Is there a way to create „Free for all“ without the different tags for each enemy team?

    The problem is that since „Enemy“ cant hit „Enemy“ I had to create more teams for the same AI controller,but after a few minutes of enemy spawning every now and then the scene gets overcrowded by the same team,and there is no fight going on at all.
     
  37. Roughrider

    Roughrider

    Joined:
    Jul 17, 2011
    Posts:
    71
    Thanks so much!
     
  38. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    Thank you invector: your code is easy to understand and get others asset working together. And Thank you Snackzila, your help was a life saver. Yours scripts integrating plygame and TPC are working amazing.

    In this demo i used Plygame. Almost everything is integrated, level growing and changing HP/Stamina/Strenght. Damage modifing with attribute scaling-leveling. AI generic controller of plygame working with Invector motor.

    This demo is just for fun, is a tribute to Final Fantasy XII, it not a comercial product. Now is time to start the real one :).



    Demo: http://ffdark.duckdns.org/
     
    Last edited: Jun 13, 2016
    snackzilla, Malbers, abatcat and 2 others like this.
  39. mediaticsvc64

    mediaticsvc64

    Joined:
    Nov 7, 2015
    Posts:
    27
    Hi
    Maybe you've told about this before so sorry if this is the case.
    I have an issue when i'm trying to set up hand to hand animations like you do on the tutorial; i download mixamo's animations but when i hit buttons to fight nothing happens, but the green line is moving as if i made an action....
    Any idea ?
     
  40. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    You're welcome. Don't forget to spell it correctly! I just noticed I spelled "Component" wrong.
     
  41. VanValdenburg

    VanValdenburg

    Joined:
    Apr 26, 2016
    Posts:
    4
    Hey guys maybe one of you can help me with this.
    Am trying to have the character jump higher the longer the jump button is pressed.

    I came up with this code but it does not seem to work for some reason.


    Code (CSharp):
    1.   if (Input.GetButtonDown(_input) && jumpConditions)
    2.                 {
    3.                     jump = true;
    4.                     actionsController.Jump.jumpForce += 1;
    5.                     ReduceStamina(actionsController.Jump.staminaCost);
    6.                     recoveryDelay = actionsController.Jump.recoveryDelay;
    7.                 }
    I also changed the jumpconditions so it does not need to be grounded but that was also not fixing my problem and made the character jump just super high on button press.
    Any hint in the right direction is much appreciated :)




    I wanted almost the same and controll the character not the camera while being locked.
    So the player can actually respond to multiple enemies and is not locked to one.
    Simply reduce the range of the locking feature to 0.

    Right now i can not remember where i did this though.
    Maybe someone can remind me where to set this locking range value.
     
  42. jgiroux

    jgiroux

    Joined:
    Jul 21, 2015
    Posts:
    22
    its in the inpector field of the actual V LockOn script component you would add to the player camera.
     
  43. VanValdenburg

    VanValdenburg

    Joined:
    Apr 26, 2016
    Posts:
    4
    Nice thanks man! Actually i did not even had that script added right now.

    You maybe got any clue about the jumping on how i can make the character jump higher the longer space is pressed?
     
  44. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Did you use the AI in this kit for the four legged creatures?
     
  45. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    There is a gravity variable on the controller. You could try to lerp the gravity lower while the space is down then lerp it back down to max when you release it.
     
  46. kidling

    kidling

    Joined:
    Sep 8, 2015
    Posts:
    9
    no, only for the humanoid ones, the others was plygame
     
    Last edited: Jun 13, 2016
  47. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    Nope, but no worries we're working on it!

    Just change your NavMesh offset base, on the Navmesh Agent component of your NPC ;)

    I'm super happy to see that you're able to modify to your own needs, that's awesome!
    Feel free to post any videos showing the results or making a tutorial for everybody too :D

    Thanks @Pregga, I'm really happy to see you guys having fun with our work!
    The Shooter will be based on the Melee, so it will have all the melee features :D

    I just notice that the stamina consuption is kind of wrong depending on the framerate, we will fix this!
    You can create more tags, and set the AI to hit the others except himself.

    That's really something! Beautifuly done @kidling :eek::D

    Try watching the Melee Combat turorial Part 1 again, maybe you miss one step

    Open the Action Input Options painel right above the ThirdPersonController inspector, there is some options to jump higher/forward there!
     
  48. VanValdenburg

    VanValdenburg

    Joined:
    Apr 26, 2016
    Posts:
    4
    Thanks Invector i saw that, it`s amazing that you have all these options. But that`s not quite what am looking for.
    Basically am searching for a method to increase the values you mentioned over time while the jump button is pressed.


    UPDATE:

    am using this code right now:

    Code (CSharp):
    1.  if (Input.GetButton(_input) && jumpConditions)
    2.                 {
    3.                     actionsController.Jump.jumpForce += 1;
    4.                     jump = true;
    5.                     ReduceStamina(actionsController.Jump.staminaCost);
    6.                     recoveryDelay = actionsController.Jump.recoveryDelay;
    7.                 }
    But what it does is increasing the jump height after every jump. So first jump is normal and the following jumps are increased. What i need is a increase of jumpForce per frame while the jump button is pressed.

    Anyone got a clue how i can increase the value over time while the jump button is pressed?


    UPDATE 2:

    it is somewhat working now with the following code:

    Code (CSharp):
    1.  if (Input.GetButton(_input) && jumpConditions)
    2.                 {
    3.                     actionsController.Jump.jumpForce += 8;
    4.                     actionsController.Jump.jumpForward += 8;
    5.                     jump = true;
    6.                     ReduceStamina(actionsController.Jump.staminaCost);
    7.                     recoveryDelay = actionsController.Jump.recoveryDelay;
    8.                 }
    9.  
    10.                 if (Input.GetButtonUp(_input))
    11.                 {
    12.                     actionsController.Jump.jumpForce = 1;
    13.                     actionsController.Jump.jumpForward = 4;
    14.                 }

    Still it's not optimal so any help is much appreciated :)
     
    Last edited: Jun 13, 2016
  49. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Thanks! I was just curious.
     
  50. Invector

    Invector

    Joined:
    Jun 23, 2015
    Posts:
    925
    Perhaps you need to reset the values when you release the button? :p
     
unityunity