Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Character System

Discussion in 'Assets and Asset Store' started by RobinS, Jul 13, 2012.

  1. Ron-Wilson

    Ron-Wilson

    Joined:
    Oct 2, 2012
    Posts:
    37
    Robin, I copied two lines and modified and pasted them back into the editor as:
    221 col.center = new Vector3(0, 1.16f, 0);
    222 //col.center = new Vector3(0, 1, 0);
    223 col.height = 3.0f;
    224 //col.height = 2.0f;
    if I am using my character I use line 221 and 223, if I am using Ninja I use 222 and 224 and for now it works.Depending on which character I am using I remark out the selected two lines. My error has to do with the auto setting of these two values the Y value of Capsule Collider and the Height setting . My model size is not affected by this adjustment just the collider my model size appears to be set by the Scale factor setting under model name, model, scale setting in the inspector window. Currently my scale setting there is .02 and normal your _Ninja 6 character scale setting there is 1.The scale factor setting there appears to be in relationship to whichever 3d package the character was created in. Mine are FBX models and 0.01 is the default.........I adjusted mine to relate to your auto setting of the Capsule Collider.
     
  2. hushbaby

    hushbaby

    Joined:
    Sep 16, 2013
    Posts:
    1
    Where is the documentation for this package? Thanks.
     
  3. jakes-du-preez

    jakes-du-preez

    Joined:
    Aug 14, 2013
    Posts:
    30
    Thank you for a fantastic package. Nothing in the store comes close to this.

    Please can someone asssist me in the direction to integrate this package with the Easy touch input system.

    much appreciated.
     
  4. Ron-Wilson

    Ron-Wilson

    Joined:
    Oct 2, 2012
    Posts:
    37
    $CharacterSystem_MyGame2.jpg

    Robin a little bit of what you have allowed me to create thanks Ron
     
  5. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi all,

    I plan to do a tutorial or documentation PDF for the next update. Please bear with me ;-)

    @NeythanQueija,
    Does the Terrain uses your grounded layer from HeroCtrl ? I tested the Character System recently on the Mobile Environment pack from the Asset Store.
    Worked pretty good. So it seems to be a layer or a grounded distance setting problem.

    @mikezenox,
    Thanks for letting me know. I will look into it.

    @Ron Wilson,
    Nice one! ;-) That looks great and your solutions seems good too.

    @hushbaby,
    It will come soon, i'm also here to help you out in the meantime.

    @jakes du preez ,
    Thank you so much! I haven't tried this asset yet. But you can use the axis and boolians with pretty much any input device.
    For instance a Joystick, has x and y axis. Up and down. You can just set these to my predefined horizontal (h) and vertical (v) axis variables.

    Cheers!
     
  6. nathanqueija

    nathanqueija

    Joined:
    Apr 18, 2013
    Posts:
    19
    Thanks for the responde @RobinS
    Yes, the terrain uses the grounded layer from the script.
    I've made a terrain and tested it and still getting the same problem, the player is walking on walls that he should stop in front of it.
    Here's the terrain that I created just for test.
    There's a hole in the terrain that the player should stop in front of wall but it automatically goes up if v>0.
     

    Attached Files:

  7. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    before the hero head to 90
    $before.jpg
    after the hero head to 0
    $after.jpg



    why when I change weapons ,the hero preb will auto set rotation to 0, (I change the hero rotation to 90 when start());

    and what I want is this result
    $right.jpg
     
    Last edited: Sep 27, 2013
  8. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    You're welcome!
    I just tested your terrain in a fresh scene. Works great. You could add box colliders or maybe cliff meshes to these terrain edges. That would look better and the character won't even try to walk an them.
     
  9. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    The character is looking along the camera's forward direction axis Z. You can disable that if you want. Just exclude the AimLookIK method. Or you could look at your target when fighting.
    The rotation thing seems interesting. I do not alter the rotation with the weapon switch system. It could have to do with internal Unity / Mecanim stuff.
    I will investigate further. ;-)
     
  10. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Robin S, I wish to turn off the recoil because it causes my crosshair to recoil as well. Where do you control that in the script?

    Thanks
     
  11. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi Venged,

    the gun recoil comes from the animation itself. You could set the animation speed of the shoot clip to 0.1 or even zero. Or you cloud bind your crosshair to an empty transform which is not related with the skeleton, but equals the aim direction.
     
  12. Venged

    Venged

    Joined:
    Oct 24, 2010
    Posts:
    500
    Thanks!
     
  13. ArcIo

    ArcIo

    Joined:
    Apr 17, 2012
    Posts:
    19
    Hey Robin.

    I got this package during your sale and it's been amazing so far. The only thing i'm having trouble with is the run/walk. When i'm running, the character seems to hiccup. It acts as though I've stopped holding the move forward button briefly and the character hesitates for a fraction of a second and then continues running. Any help would be awesome!
     
  14. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    Hey Robin or anyone else who might know,

    I managed to make an "aiming" state by using the first frame of the rifle firing animation and an upper body mask. Getting the character's rotation on the y axis to face the same direction as the camera is easy enough, but the x axis is a bit of a challenge. Is there a way to get the character's torso to "bend" to face the direction of the camera? If I'm understanding things correctly this is actually handled by the character system already using IK if you have Unity Pro, but I'm wondering if there's a solution available for those of us using Unity Basic.
     
  15. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    On thinking about it, one possible solution would be to have an animation for aiming up and one for aiming down, and then you could put them in a blend tree with the neutral aim state in the middle. The only problem is that somebody would have to actually make those animations, and I don't see anything like that on the asset store.

    Does anybody know of an animation set that includes such a thing? If not, I'd like to request directional aim animations for the guns.
     
  16. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi all,

    @Venged, you're welcome!

    @Arclo, Glad to hear! Hmm.. have you tried to raising the time span of the transitions from movetree to sprinttree ?

    @Lork, Yes you're right. I was thinking about doing the aiming that way at first. But that would limit the aiming to the animations itself. Means if you want to aim in a wider angle you will have to change the animations every time while adjusting. Yes i was using the camera's look direction/rotation to bend the character with this : http://docs.unity3d.com/Documentation/ScriptReference/Animator.SetLookAtWeight.html

    Cheers!
     
  17. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    good morning, robin.

    what is the best way to calculate distance to the ground for your system? does it already have one or do i need to extend something like isGrounded and build one around that var?
     
  18. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi mcconrad,

    with Raycasthit.distance from the grounded sensor. If you want the distance from the feet level you would have to subtract the half capsule height. It is casted from the capsule's center.

    Cheers!
     
  19. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    Thanks!

    I also noticed a possible bug. Players can basically float up near vertical inclines because they are considered ungrounded yet still able to move while in this state. Although you can take away player control during a free fall, this has the possibility of getting players stuck when not actually falling, so is there a better way, like preventing movement in positive Y axis while ungrounded?
     
  20. lsgheero

    lsgheero

    Joined:
    Mar 24, 2013
    Posts:
    60
    Are you planning to release or can you offer some advice for how to sync mecanim animations via network. If I pass the input variables that you use to control the system via the update section it will walk and jump just fine but it only occasionally uses the weapon draw/holster commands, and the attack commands. I didnt want to simply play the animations since you also have to show the weapons, etc.

    I am using photon networking and doing this via an RPC and a copy of the script which i called Remote_HeroCtrl
     
  21. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Hi Robin, I have two questions about the legacy 3.5 version:

    1) I'm trying to add in the procedural motion section of the hero animation script a way for the player to lean forward when the sprint button is held down. At the moment the player leans side to side procedurally based on horizontal axis input, I'm trying to do something similar but only in the forward direction. I've tried playing around with it but the player is only leaning forward when the horizontal axis keys are pressed, and not when the sprint key is held. How could I do this?

    2) I also want to modify the jump functionality so that whether the jump key is pressed quickly or held longer it will always send the player the same amount into the air. At the moment the longer you press the jump key the further you go, and I'm not really sure what I should change to get the needed effect. Any suggestions on this?
     
  22. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    This is incredible work! I will almost certainly be buying this on next pay day :D But im wondering, is there a way to get the guy to hug walls and creep along them, and to pop his head out around corners to take a shot at the enemy? And hide behind small boxes and pop out to shoot etc? (Ordinary AAA game mechanics these days) It has every single possible feature I could want, apart from possibly these, hopefully its easy-ish to add new states?

    Overall I watched the videos in disbelief - its very very cool!! I didnt see much of the first person but I will try the demo out :)..
     
  23. ArcIo

    ArcIo

    Joined:
    Apr 17, 2012
    Posts:
    19
    So i got the other issue resolved. Thank you for the help. However, there is another bigger bug that's a major issue and I hope you have a solution for this. My character can walk through walls. He can punch through walls and if you stand in front of a wall, he can jump through them. I tried everything I could think of but then I loaded the scene "Mec_CharSys_01" that came with this package and sure enough, the ninja can go through walls as well.

    I hope that there is solution to this because I would love to use this system but this is pretty mission critical.

    Any help would be greatly appreciated.
     
  24. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    how to change weapon from sword to bow without need draw Holster step
    current I need to press key v ,and then key q
    what I want switch weapons by key q only.

    here my code but not work ,It's still on sword conditon..
    and after I change animtor like this
    $test.jpg
    and add a bool value FromeSwordToBow
    but still not work.any Idea? thanks.
     
    Last edited: Oct 10, 2013
  25. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi all,

    Sorry for the silence, I'm on vacation.

    @mcconrad, Thanks for your feedback. I will look into it ASAP;-)

    @lsgheero, networking is pretty complex and out of scope for this package. But I would suggest you to sync trigger for anim controller states. And rigidbody velocity ,angular velocity and rotation to sync movement across the net.

    @Hamesh81, 1) you can use the bones local axis to rotate them, like in my examples. Currently I can't start unity to look what axis that is sorry.
    2) you can make the jump power applied at one frame only by firing it due buttonDown instead of Input.getbutton.

    @radiantboy, Thank you! Glad to hear that. You can use the climb system for that. It's pretty much the same. But the animations for a metal gear solid like wall hugging are not included. Thanks again. I appreciate your positive words ;-)

    @Arclo, Glad to hear that. This could be a framerate issue. Happens often whit fast moving objects or on low frame counts. At least on my machine.
    You could use primitive colliders (Box collider) instead the mesh collider on sensitive areas. These are more stable.

    @layola, I will look at it ASAP. Have you tried to trigger it from the combat method? I just needs to work the same way as in the base method.

    Cheers!
     
  26. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    more ?'s from me,
    how would i take control of the camera from the herocamera script? i have it accessed by a script i am writing to shake it during a sequence with
    private var camControl: HeroCamera; camControl.cam.position = new Vector3(originalCamPos.x +x, originalCamPos.y +y, originalCamPos.z +z); and so forth, but even though i know i am accessing it (debug.log is giving me correct values) it doesn't actually override it to the point where i can modify the position. i'd prefer *not* to use enabled = false method of doing it if possible.
     
  27. Hamesh81

    Hamesh81

    Joined:
    Mar 9, 2012
    Posts:
    405
    Thanks for the advice RobinS, I worked out the procedural part. For the jump I'm actually using a 2 key input which makes it difficult to use GetButtonDown, since the player would have to press two buttons in the same frame to jump. I think I'll post this part on Unity Answers though since it's a more general issue now. Thanks a lot ;)
     
  28. lsgheero

    lsgheero

    Joined:
    Mar 24, 2013
    Posts:
    60
    I ended up just breaking out of the update functions and moving all the weapon changes, firing, etc into rpcs that are triggered by the normal players script when they are executed on their system works well, time will tell of there are any issues with doing it this way.

    I did have another question however. I tried editing the FBX animation by importing it into 3DS Max and it lets me do that just fine but when I import the fbx back into unity (even if I just open and save the fbx with no changing the keys) it snaps the model in half like the back is broken lol. Know of any reason that would be. I am using this system with a robot so the motions are fine just need to edit out the spine twisting, etc. should just be a up/down motion when walking no side to side.
     
  29. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    hi,I got some trouble in moblie
    I don't konw how to tell when I ontouch screen to move Character.
    I do something like this ,And I disable FixedUpdate keydown ,but not work
    heroCtrl.doFwd = true;

    but hero not move..what was wrong?
     
  30. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi all,

    @mcconrad,
    You could create an extra state for this shaking effect. Switch to it when needed an go back to the state you want after a time span.
    You might want to take a look here http://answers.unity3d.com/questions/26375/is-it-possible-to-shake-the-camera.html

    @Hamesh81,
    I'm glad that i could help ;-) Yes, that would be the best approach i guess.

    @lsgheero,
    Sounds good. The Import / export is issue could be caused by the wrong scaling factor. I had that a few times when i forgot to scale the models to 1.0 instead of 0.1 in the import settings. which is Unity's default scale.

    @layola,
    I don't know what kind of touch controls you want to archive, but this might be helpful : http://answers.unity3d.com/questions/126046/help-with-iphoneandroid-touch-controls.html


    Cheers!
     
  31. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
  32. junkyardog

    junkyardog

    Joined:
    Feb 20, 2009
    Posts:
    92
    Robin:

    Picked up the Veteran + Mecanim CS. I trust both CS's will be maintained at the same rate? If you specify a need to do something for one version will you include the other as well (such as Ninja 4.2.6 or Veteran 1.03) just to keep us on the same page?
     
  33. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi junkyardog,

    Yes, they will be maintained equally. the version difference is just because the vet package was added later.
    I will submit updates for both packages in one push. (maybe i should align the version numbers ;-))

    Cheers!
     
  34. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,408
    hi

    demo links on front page are bad :(

    but was able to check out demo using links in post

    jump is still off, sort of jerky when up against something its strange sometimes it vaults over and sometimes it squat jumps over sort and sometimes it sort of glides over

    when you land it pauses noticeably before continues to walk/run

    also c/q still requires repeated key presses even when fully idle.

    best regards
     
    Last edited: Oct 15, 2013
  35. pixelsteam

    pixelsteam

    Joined:
    May 1, 2009
    Posts:
    924
    Robin,
    Is there a proper PDF documentation for this? I wanted to know before I buy it...as the video tutorial cannot be followed;(
     
  36. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    I'm working on it. At the moment i'm very busy. But it will come with the next Update for the CS ;-)
     
  37. layola

    layola

    Joined:
    Aug 6, 2013
    Posts:
    94
    hi,robins
    I change the hero to other model
    but I get some error about capsule collider error
    the model mesh some time will below the capsule collider,it's not align.why?
     
  38. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    thank you for reply, but the camera shake script is working fine, it just doesn't shake the camera when it is under the control of the herocamera script. i have a second camera that is basically an establishing shot that gets shaken, then switches to the player camera and uses invoke repeating on the same script (different camera) but it shakes the player head bone instead. i will keep looking into it.
     
    Last edited: Oct 15, 2013
  39. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi,

    @layola,
    Does it work when you exclude line 221 and 222 from HeroCtrl ?
    If not, what does the error message say ?

    @mcconrad,
    You're welcome. Maybe its just applied to the wrong transform. I called the camera transform "cam". Hard to tell with that info, but your described setup sounds ok to me ;-)

    Cheers!
     
  40. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    just found another small bug, i think.
    walking or strafing backwards while holding a drawn weapon makes player move at largely increased speed and it looks very off and also seems to list to the left backwards. anyone else had this problem?
     
  41. Lork

    Lork

    Joined:
    Jul 12, 2013
    Posts:
    79
    I'm trying to get the character's velocity for the purpose of ballistics equations, but Rigidbody.velocity doesn't seem to work right. It's always at 0 even when the character is moving. I'm assuming this is because movement is handled by the animator/script instead of the rigidbody itself, but if that's the case, how can I get the character's velocity?

    I tried simply calculating the velocity based on the difference between character's previous position and their current one, but that produced erratic/useless results due to the way animation driven motion moves the model by an arbitrary amount each frame rather than with a constant speed.

    Edit: I managed to find a partial solution: implementing a GetVelocity() function in the controller script that calculates a vector based on the "Axis" values in the animator, the character's movespeed and a hardcoded value based on the "average velocity" of the run animation (taken from the inspector). However this is a very unwieldy solution, requiring special cases for every animation that moves the character with magic numbers based on the "average velocity" of those animations, so I'm hoping somebody knows of a better way to do it.
     
    Last edited: Oct 16, 2013
  42. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi all,

    @mcconrad,
    I couldn't reproduce this. Does this also happens in the demo's i uploaded recently on your side?
    Thanks for reporting!

    @Lork,
    It's the root motion, calculated by Mecanim which drives the character. Not mainly the rigidbody velocity. I'm only using it for jumping, flying, swimming, and climbing etc.
    root motion is applied in OnAnimatorMove ().
    I guess your solution is the way to go for tracking root motion velocity until we get a native GetVelocity() function for the Mecanim API.
    You could also look for the transform velocity like : float velocity = (currentPos - previousPos).magnitude;
    Hope that helps ;-)

    Cheers!
     
  43. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    As of this morning, I cannot reproduce it either... o.0 so i am guessing it was just a random fluke with unity.:confused:
     
  44. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi,

    @mcconrad,
    Ok, good to know ;-)

    @hallsofcamelot,
    Thanks! Glad you like it ;-) You can tweak the rotSpeed variable for HeroCtrl and zoomDamping, rotationDamping for the HeroCamera script.
    Both via the Inspector.

    Cheers!
     
  45. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    guess who again!

    i think i am running out of questions, finally, but this time it is about added a new state in mecanim. i made an isDying and isDead state with a transition from Any State -> on boolean = true, however from certain states this does not appear to be working. for example, often when the character is running and dies (instantly due to a script), the character stays in a loop in that particular state (falling, crouching, running) and will not get the transition to the dead state. does each layer in mecanim need a transition from any state to these new ones?
     
  46. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hmm.. You could try to restart Unity. Sometimes it seems that newly added anim clips won't be recognized by the animator. No, any state just let you trigger clips from anywhere, independent of the state you're currently at.
     
  47. mcconrad

    mcconrad

    Joined:
    Jul 16, 2013
    Posts:
    155
    not a reboot issue as i have been working on it for days. i can PM you a link to my game W-I-P to give it a look if you have the time?
     
  48. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Yes sure, i can take a look.
     
  49. John-Lattin

    John-Lattin

    Joined:
    Oct 7, 2013
    Posts:
    14
    Hey Robin,

    I realized that your system doesn't include pushing or pulling an object (such as a block), instead it is pushing a button. Using the terminology of "pushing" seems a bit deceiving, as I am not sure that anyone generally associates pushing a button with just the word "pushing". Do you have plans of adding these other two animations in?
     
  50. RobinS

    RobinS

    Joined:
    Sep 2, 2011
    Posts:
    417
    Hi,

    pulling and pushing should be interesting for many users, will put them on the list. Thanks for the input!