Search Unity

Controller Renegade Project [DriverN Shooter system]

Discussion in 'Tools In Progress' started by dibdab, Aug 4, 2017.

  1. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    aiWalker evade variations (cont'd)
    red is enemy, green is destination
    aiwalk3.gif aiwalk3.jpg

    + look at enemy
     

    Attached Files:

    Last edited: May 4, 2020
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    here's how loop can be done:
    first target set, and then usin seq of target-change based on distance
    three loops but stops only on the next


    there's ASeq () for anim seq too
    aiactionAseq.gif
     

    Attached Files:

    Last edited: May 4, 2020
  3. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
  4. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    the different versions going from ragCopy:
    simple going ragdoll

    going animated

    and going blended
    ragblend3.gif
     

    Attached Files:

    Last edited: May 4, 2020
  5. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    I'll add this little script I use when want to redo the T-Pose
    (must be removed from project, will not build)
    it exports to .asset, which then can be exported as .obj
    exportmesh.jpg
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEditor;
    5.  
    6. public class exportMesh : MonoBehaviour {
    7.  
    8.     public SkinnedMeshRenderer[] smr;
    9.     public string folder;
    10.     public KeyCode export = KeyCode.Space;
    11.  
    12.     void Update () {
    13.  
    14.         if (Input.GetKeyDown (export)) ExportMeshes ();
    15.     }
    16.  
    17.     void ExportMeshes () {
    18.  
    19.         AssetDatabase.CreateFolder("Assets/export", folder);
    20.  
    21.         for(int i=0; i<smr.Length; i++){
    22.                            
    23.  
    24.             Mesh msh = new Mesh();
    25.             smr[i].BakeMesh(msh);
    26.            
    27.             AssetDatabase.CreateAsset(msh, "Assets/export/" + folder + "/" +smr[i].name + ".asset");
    28.         }
    29.     }
    30. }
     

    Attached Files:

  6. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    the automatic jump works now

    next will do some method to choose jump style based on some condition
    (not just the first one that comes up)

    noticed that for not-forward jumps the raycast needs to be rotated
    [raycast at jumpPoint is used to check if hand-support is till there]
    rays_automjump2.jpg
    so added variable for angle
    public float jPCastAngle;//raycast angle at jump point [default 0 is forward]

    otherwise would not detect that jump is okey
    and would go ragdoll

    automjump2b.gif
     

    Attached Files:

    Last edited: May 4, 2020
  7. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    ragCopy is called ragBlend now
    and integrated in Renegade
    ragblendb3.gif
     

    Attached Files:

    Last edited: May 4, 2020
  8. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    locostart
    [animations not included unfortunately]

    startloco.gif

    all controlled by 4 arrows
     
  9. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    upbodyMX probably will be the primary solution for gun animations
    though weapon state machines can be used too

    can create and modify weapon animation
    separate weapon locomotion
    upbodyf.gif
    benefits
    - no need for even the one leftHand IK (weapon grip), if the pose is precise
    - breathing unaffected
    - no need for animations (lower file size)

    drawbacks
    - cannot do load/draw weapon anim (though might be possible to use one)

    work1.gif
     
    Last edited: May 4, 2020
  10. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    also a punching bag demo that wasn't showcased
    punchinbag.gif
     
  11. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    improved strayLoco
    strayloco3.gif

    also started to redo the sword mechanics
    to be based upon (start from) left and right stance
    something like this [preview]
    swordst.gif
    so if the move changes stance, no need to define
    if it is a left cut or a right cut (because the stance is tracked)
    but there are slashes which do not change stance
    and haven't decided what to do with those
     
  12. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    with this simple script was able to correct one cmu animation
    used along with playTime

    Code (CSharp):
    1. public class fixerBlend4BoneX : MonoBehaviour {
    2.     //for animator >> based on normalized time
    3.     //blending between two vec3s w animCurve [of normTime]
    4.     public Transform bone;
    5.     public Animator animator;
    6.     int i, x;
    7.  
    8.     public float nTime;
    9.     AnimatorStateInfo animStateInfo;
    10.  
    11.     [System.Serializable]
    12.     public class rX {
    13.        
    14.         public Vector3 rStart;
    15.         public Vector3 rEnd;
    16.         public float tStart = 0.5f;//[normTime]
    17.         public float tEnd = 0.5f;
    18.         public AnimationCurve animCurve;
    19.     }
    20.     public rX[] RX;
    21.  
    22.     public float perc;
    23.     public bool overridePerc;
    24.     [Range(0.0f, 1.0f)] public float percOverride;//for manual realtime check
    25.  
    26.     public bool multi;//rotation multiplied or straight
    27.     public Vector3 rFinal;
    28.  
    29.     [Space(10)]
    30.     public bool rotation = true;
    31.     public bool position;
    32.     bool inRange;
    33.  
    34.     void LateUpdate () {
    35.  
    36.         animStateInfo = animator.GetCurrentAnimatorStateInfo (0);
    37.         nTime = animStateInfo.normalizedTime;
    38.  
    39.         inRange = false;
    40.         for (i = 0; i < RX.Length; i++) {
    41.  
    42.             if (nTime >= RX [i].tStart && nTime <= RX [i].tEnd) {
    43.                 x = i;
    44.                 inRange = true;
    45.             }
    46.             if(nTime > 1 && RX [i].tEnd == 1) inRange = true;
    47.         }
    48.  
    49.         perc = RX[x].animCurve.Evaluate (nTime);
    50.         if(!overridePerc) rFinal = Vector3.Lerp (RX[x].rStart, RX[x].rEnd, perc);
    51.         if (overridePerc) rFinal = Vector3.Lerp (RX[x].rStart, RX[x].rEnd, percOverride);
    52.  
    53.         if (inRange) {
    54.             if (position) bone.position = rFinal;
    55.             if (rotation) {
    56.                 if (multi) bone.localRotation *= Quaternion.Euler (rFinal);
    57.                 if (!multi) bone.localRotation = Quaternion.Euler (rFinal);
    58.             }
    59.         } else {
    60.             if(!overridePerc) rFinal = new Vector3(0,0,0);
    61.         }
    62.     }
    63. }
    64.  
    the original on the left
    blendCorrect.gif
    and with one more clean-up
    blendCorrect2.gif
     

    Attached Files:

  13. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    improved helicopter ai
    aiChopper1.gif
    a helicopter shootout mini-game
    https://www.mediafire.com/file/kxgm2wd2fytxqfm/heliShootout.ZIP/file
    was late to realize that there's a high propability the enemy copters crashing into each other
    because they are crossing their paths [will switch them next time]

    controls:

    fire-up leftAlt
    accel leftShit
    slow leftCtrl
    ← ↑ ↓ → J G


     
  14. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    Last edited: May 24, 2020
  15. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    about the sword mechanics

    so issue was that a cut from left can only be started from left stance
    so had to do switch stance before cut

    had all kinds of problems with triggers, events
    even started to redo it into based on state normalized time
    but went back to it, now kinda works
    swordco1.gif
    swordco3.gif
    here you can see couple frames where the attack should have started sooner
    it's not the code (the anim should fire) there is dark zone
    but crossfade should work even while transition in mecanim

    swordco2.gif
     
  16. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    before it gets forgotten and redone
    snapshots of upbodyMX and pointAt

    pointAt is kinda final : spine and head lookat had been added
    upbody.gif
    the execution order is (if I'm not mistaken)
    - ikControl
    - Renegade.ragBlend
    - Renegade.CCD
    - upbodyMX
    - pointAt
    - fingers
    ragblend+pointat.gif

    contrary to this, ragblend cannot be initiated while pointAt is on (weird results)
    after fixed and copying ragdoll, pointAt can be turned on
    ragblend+pointat3.gif
     

    Attached Files:

    Last edited: Jun 12, 2020
  17. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    simple smoke turbulance
    particTurb.gif
     
  18. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    Renegade.CCD.head
    locoStart false
    ccdhip.gif
     
  19. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    quick note on strafe+upbody:
    hip should look right, like the base pose (left foot forward)
    here going left is left foot forward, going right is right foot forward
    strafeupbody.gif

    ---
    now fingers can use quaternion and eulerangles too
    play/copy back and forth

    ---
    animator test results
    performance of 100 actor models
    animator: one layer
    actor:
    1 obj 6500 tris: 8.0ms 125fps
    2 obj 1500 tris: 8.5ms 115fps
    2 obj 6500 tris: 9.5ms 105fps

    so it's very much worth to combine and use models made of one object
     
    Last edited: Jun 17, 2020
  20. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    looks like this could work
    fract1.gif
     
  21. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    this is sad

    5.6
    50_567.jpg
    2019.4
    50_20194.jpg
     

    Attached Files:

  22. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    the right method might have been found
    swordcox.gif
    this stance-based approach is going to be implemented to fighting too
    the previous #265 I think was my mistake initiating crossfade to same state

    -there's events for every attack: sAttackOn sAttackOff stanceL/stanceR
    -needs: root rotation baked
    rootTRbaked.jpg

    -can be two stances for one attack
    startin from R: going to L and ends on R
    stanceRLR.gif
     
  23. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    R098.gif
    as you may know, assetstore doesn't allow uploadin projects with pre-2017 version now.
    so the 5.6 scenes are going to be included zipped

    the latest upload was rejected (probably for issues w 2018.4, though the code gives no errors)
    so gonna use this time to go for the changes wanted to do for optimization sake

    - not using gravityWeight anim curves
    - limiting the use of statebehaviors (which doesn't update well for 2018.4)
    - using hashes instead of strings for crossfade [done]
    - using CrossFadeInFixedTime [done]

    and a thing noticed just now
    CrossFadeInFixedTime can transition to the same state, while CrossFade cannot!

    this has a big effect on animator and code
    although since there is animSelect on blendtree, must keep this version
    unless redoin param float lerp



    it's better to switch off dynamic capsule height for crouch
    and use curve on animation for it

    update
    aiWalkerMX: stuck detection (by velocity and by position) > bool isStuck
    jumpMX: switchin off capsule while targetmatching > bool switchOffCapsMatchT
    capsule height: for every state (loco, slide, crouch, jump etc) could be now
    1. dynamic capsule height
    2. capsule height by curve on animation
    3. hard-set value for capsule height


    runslid.gif
     
    Last edited: Jul 4, 2020
  24. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    pointatdive1.gif
    pointatdive2a.gif

    aiWalkerMX:
    avoidance + auto jump
     
    Last edited: Jul 4, 2020
  25. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    new feature idea:

    virtual transition list

    next action list (blend tree) reusable for MX
    initiated by nTime/event+input if ready
    every action prop can be array
    (and can be by selected float, with orderingMind: analyzed next by btmatrix)
    so its basically crossfadein in a mecanim state (seq) onjumpx, onpunchx, onkickx, onslidex, onrollx...


    state : second move
    punch : avoid elbow knee (backfliponknee roll sweep... )
    kick : dodge kapuera elbow spin backstans jump flipjump...
    slide : roll getup ...
    jump : ground headground crouch spin...

    default third: getup

    CrossFadeInFixed


    class actions
    bool[] ready
    bool[] ins
    hash[] action

    class order
    float[] nTime
    int[] pose
    btmatrix[pose][action]


    should look like this:
    (animation seq test)
    virttranslist.gif
    virttranslistb.gif
     
    Last edited: Jul 8, 2020
  26. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    body pose analyzer
    bodypose.gif

    roll by pose
    rollbypose.gif
     
    Last edited: Jul 8, 2020
  27. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    okay, finally got this workin (for roll and slide)
    there's secAction based on bool use and int pose, initiated on contactPoint

    root transform rotation should be baked
    because if it's not, can mess up pose detection
    see 1. baked 2. non-baked
    rootRbaked.gif
    rootRnonbaked.gif

    can be autom or can be input
    input should be pressed before contactPoint

    looks like this
    without secAction
    jumpsa0.gif
    with secAction.slide + another anim, second roll
    jumpsec0.gif
    with secAction.roll + another roll
    jumpsec1.gif

    and there's weight for slide/roll (higher one is played)
     
  28. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    doublejump working alright

    also added switchAction
    here's how it looks w 0.2 and 1.0 blend value
    more blendin helped to look better (but need to calc in com n vel)
    swtchaction.gif
    swtchaction1.jpg
    swtchaction10.gif


    wanted it able to play any state on mecanim
    so it needs a bit more configuration for any state
    it checks for pose and receives input in jumpstate ungrounded and that's it, plays exe
    swtchactionroll.jpg

    probably will throw out Renegade.state and pose check for jumpin initiation
    ground check is enough, haven't had to use them yet, maybe velocity check should be+
    probably reversed my initial plan, cause I think that if even possible probably d'be more complicated
    would that be anystate config matrix and this is more like estimated chaos : ),

    so for now
    there's slide roll jump jumps jumpOn jumpOver jumpDwn on JumpMX2
    and jumpClimb should come next

    jumpx : the initiated jump
    doublejump : new jump while jumpstate grounded
    onJumpx : reachin while jump > ragBlend
    secAction : changing jumpstate on contactPoint
    switchAction : changing jumstate ungrounded
     
    Last edited: Jul 23, 2020
  29. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    added groundcheck event
    and stumble, fall-pose > ragdoll behavs
    doublejump animstart
    doublejump.gif
     

    Attached Files:

    Last edited: Jul 30, 2020
  30. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    jumpClimb first version workin
    with IK handpositioning

    the blendttree transition looks like this
    jumpClimba.gif
    ingame
    climb.gif
     
  31. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    added second matchtarget for jumpClimb
    added targetP offset
    added rootP adjustment by animationcurve (see actor on the left)

    jumpClimb > doublejump

    hangjumpdown.gif
     

    Attached Files:

    Last edited: Aug 9, 2020
  32. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    think I forgot about this one
    got buildgen kinda work with floors but should redo it
    buildgen1.gif
    builds generated
    buildgen.jpg

    needed jump > freehang animations
    [because transition issues w rootpos/com]
    jumphang1.gif
    jumphang2.gif
     

    Attached Files:

    Last edited: Aug 20, 2020
  33. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    customers are eligible for RawFormula boards access.
    drop me a line on pm w a proof of purchase.
    new content coming [game ready models]

    try to get up a new version [0.98] on the store as soon as possible

    newest versions of scripts, prototype packages available upon request
     
  34. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    couple issues will have to chase down on this too

    aifighter.gif
    http://www.mediafire.com/file/ccgcqqg5rqdgh7x/aiFighter001b.ZIP/file

    set fade times to 0.15
    and animator state speeds to 1.15

    the keyboard controls a bit awkward because of key-combos
    gamepad should feel better

    fight has different loco and steppin states
    can mix but if key-input not on time looks bad [fwdArrow / Tkey]
    walk.gif
    the stumble feature on JumpMX
    but sometime its too much
    stumble.gif
    and when doesn't stumble
    slideroll.gif
     

    Attached Files:

    Last edited: Aug 20, 2020
  35. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    Last edited: Sep 3, 2020
  36. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    blended result
    stepsxblend.gif
     
  37. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    added muscle curve modifier tool for extracted curves
    hcurvemod.gif

    and basic rootmotion P and R tools
    animRQ.gif
    animRP.gif
     
  38. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    added new variations for fighter movement
    fightermov.gif

    can rotate
    fightermoves.gif

    after I build the new fighter demo will start to construct the scenes for the new version and send it in
     
  39. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    attention customers:
    got a complaint from someone, that project downloaded from the asset store had missing files,
    so I sent him the missing files.
    if you have similar issue, contact me.
     
  40. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
  41. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976
    already started to work on 0.99 version
    I'm going to tear it apart and build it up again

    going to remove 2D blendtrees.
    ::the usual way to do 2D blend trees is bad because
    - if idle anim is at center (0,0), when input blends through that value it adds noise to the animation (only can make it less noticeable, if idle pose looks like movement pose)
    - and also abrupt changes in blend parameter cause root position error
    (that's why can't do direct walkF > walkB / walkL > walkR)

    with the new design it is possible, no root position error and I think every feature of the 2D blend tree can be replicated
    look at the prototype (the closer one)
    R099.gif


    http://www.mediafire.com/file/899azktz33gwc6x/R0991.ZIP/file
    II pretty like it
    it needed a couple tricks to work
    and still needs a bit of coding yet
    R1demo.jpg

    I'm going to switch to post as mi publisher account next, do nutt be surprised
     
    Last edited: Sep 18, 2020
  42. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    the diagonals don';t have runs
    the runs don';t have stops
    but the fwd - back seems to work w speeds too
    R0992.gif
    might be trackin leg fwd and startin new move based on that

    the controls are the usual
    G F : left / right
    M N : speed up / down
    http://www.mediafire.com/file/4rp23vm00zbkz1g/R0992.ZIP/file
    update: walkB wasn't synchronised
     
    Last edited: Sep 18, 2020
  43. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    Last edited: Sep 20, 2020
  44. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    added turns which can be interrupted (at any time by loco)
    R0997.gif
    prob the idle transition issue still there just not visible, because input method was changed
    there's the occasional root hickup I'm guessin the animator blend order is the culprit (must try separate all states' parameters)

    A D : turn L R
    W S : turnAngle
    http://www.mediafire.com/file/xfykxqppexyr9uj/R0997.ZIP/file

    all have to track those points
    R0997a.gif

    there's also hip, spine, hand positioners (ccd, anim.bodyPos) and feetIK in plannphase
    I think for lowering head animations are better
    for physics reactions and results can use hip-spine modif (+limbs limited)
    and for avoidances (that with focus on fees)
    for aiWalker not needed (can do all through animator)
    might be good for transitional states like poses (falling pose, defending pose etc)
     
  45. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    the update is in the asset store
    R098.jpg
    uploaded with 2018.4 but includes 5.6 scenes
     
  46. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
  47. hellosimplegame

    hellosimplegame

    Joined:
    Jun 13, 2017
    Posts:
    8
    Hi @bobadi is this Template works on mobile and do they have mobile input control?
    Thanks!
     
  48. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    Hi

    no, it doesn't have mobile input control
    but it is easy to integrate because every input variable is separated in Renegade

    like this
    simplified example:
    Code (CSharp):
    1.     void Update () {
    2.         if (useInput) checkInputs ();
    3.     }
    4.     void checkInputs() {
    5.         h = Input.GetAxis ("Horizontal"); //float
    6.         v = Input.GetAxis ("Vertical");
    7.         ins.doRoll = Input.GetKeyDown (ins.roll); //bool
    8.     }
    you have a mobile input package, where you get float/bool values
    in your mobile control script: float hx, bool rollx

    don't have to anything with Renegade code,
    you just make a controlscript (see RenegadeGP for reference)
    you make useInput = false in Renegade
    and you just replace input variables like this in your controlscript
    Code (CSharp):
    1. public Renegade Renegade;//drag and drop here
    2. void Update () {
    3.     Renegade.h = hx;
    4.     Renegade.ins.doRoll = rollx;
    5. }
    and would probably want to add it before Renegade in script execution order
     
    hellosimplegame likes this.
  49. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    gonna include IK control inside Renegade from now
    here's how Renegade looks now in inspector

    csrenegade.jpg
    also tested 32 actors and got 40 fps inside editor, so I'm happy with that.

    http://www.mediafire.com/file/3008ryg3h98eki4/R0998_32.ZIP/file

    there's a strange bug in it
    first the turning animations work, then somehow as if there was no animation (it goes default binding pose)
    oh I see, it's missing anims in the turning blendtree on high xc (speed input)
     
    Last edited: Sep 23, 2020
  50. bobadi

    bobadi

    Joined:
    Jan 3, 2019
    Posts:
    670
    another animation tool

    from this to that
    modmulti2.gif
    modmulti3.gif