edited April 2016 in ORK Support
Hi

I was doing some improvements in my game project and make some animations to work, but I would like make my character draw and holster a sword weapon for example. I asked before here (http://forum.orkframework.com/discussion/2794/problems-with-control-maps#latest) how to do control maps and bind some actions to my character. I´ve made a Global event and linked it with another event animation I´ve done (DrawWeapon) but I found one simply problem I would like to fix, if anyone can help me of course. How I could make visible my weapon (equip) or (unequip)?

I´ve made a equipment viewer for my katana sword but I don´t know what kind of event or which node event I must set to display the weapon over the hips of my character when the weapon hasn´t been draw and show it in my character´s right hand when decides to draw it again.

I´ll post some images about my event:

0 Main Menu unity Honshu PC, Mac & Linux Sta
0 Main Menu unity Honshu PC, Mac & Linux Sta
Post edited by berbelias on
  • Look at using Animation Events: http://docs.unity3d.com/Manual/animeditor-AnimationEvents.html. You can tag the exact frame in the Draw Weapon animation where you want to hide one viewer and show the other (and likewise for the Sheath Weapon animation). When the event triggers, you call a custom function that toggles the visibility of the viewer.

    Alternatively, you could use an Animation Curve to identify the frame where you want this to happen: http://docs.unity3d.com/Manual/animeditor-AnimationCurves.html. You can add a simple component to the GameObject with the Equipment Viewer in it that monitors the animation and hides the viewer when it detects the spike at the designated frame.

    This requires a bit of coding, but it's the best way to have the equipment visibility match your animations.

    I need to do this for my game at some point; I'll post the code here if I get to it before you find a solution.
  • edited February 2016
    There are 2 ways to do that:

    1) Parent the wanted equipment viewer on a different part of your combatant's game object (e.g. from the hip to the hand). This can be done using a Mount Object step.

    2) Use 2 equipment viewers that use a variable condition to check which is used. Change the used variable in the global event.
    E.g. a bool variable weapon_drawn, on the hip, you'd have a check for this being false, on the hand you'd have a check for this being true.
    Post edited by gamingislove on
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2016
    Thanks again that´s give me a idea about how I must doing that event, but I have another question
    about the first way, I must set Mount Object step after the combatant animation step
    1) Parent the wanted equipment viewer on a different part of your combatant's game object (e.g. from the hip to the hand).
    How I parent the equipment viewer from the hip to the hand? I must have one equipment viewer and another copy of it in the hips for example?
    2) Use 2 equipment viewers that use a variable condition to check which is used. Change the used variable in the global event.
    Each equipment viewers must have only one variable condition? this used variables must set up in World> Global events in Variable Conditions must add a game variable and set the other variables I´ve adjusted before in equipment viewers, Thats right?
    Post edited by berbelias on
  • berbelias said: How I parent the equipment viewer from the hip to the hand? I must one equipment viewer and another copy of it in the hips for example?
    You'll need to define the path to the hand game object in the Mount Object step. When putting it back, you need the path to the hip game object.
    berbelias said: Each equipment viewers must have only one variable condition? this used variables must set up in World> Global events in Variable Conditions must add a game variable and set the other variables I´ve adjusted before in equipment viewers, Thats right?
    Yes, in this case the hip and hand equipment viewers have each one variable condition. Your draw/sheath events will change a game variable, the equipment viewers check for the variable.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2016
    You'll need to define the path to the hand game object in the Mount Object step. When putting it back, you need the path to the hip game object
    I´ve done the first way you said before, use Mount Object step, but my character doesn´t mount the sword in the hips, I don´t know if I´m doing something wrong. I´ll post some screens with event I´ve done:


    Screen01
    subir imagen



    Screen02
    sube fotos




    Post edited by berbelias on
  • You don't need a prefab - that would be handled by the equipment viewer. Now, you need to use the game object where the weapon's Equipment Viewer component is attached on the player's game object as the Object that is mounted (i.e. define the path to the equipment viewer in Child Object). The Target Object would be wherever you want to mount it (i.e. the player actor, using On Child to define where to mount it).
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • I´ve done it, thats is really awesome :D but now I must adjust the position transform of my sword over my character chest, I´ve set up that parameters in events, but the sword still display nailed on my character. If i want to make the contrary effect of this event (e.g. draw the sword on my character´s hand) I must do another similar event or I could do it with another step? I press again the key where my character draws his sword, but he only draws his sword over the chest. :S

  • I´ve solved it, I have another event with inverse effect and adjusted all the parameters as I did before, now my character draw and sthealth the sword smooth and fine. Thankss gamingislove and Keldryn for your help :D
  • edited April 2016
    Sorry again, but I found some issue which I didn´t see before with mi character, I´ll post a video where I show what happens. The problem go from the key buttons, when I press again the command which executes the events of drawing and sheathing the sword some strange issue begins display, my character changes position and the camera freezes, could be something wrong I didn´t do well, sorry for inconvenience, I'm not a good programmer and It could be some detail I´ve forgotten.

    Thanks again :(
    Post edited by berbelias on
  • edited February 2016
    Oh geez, I remember having that issue when I started playing with ORK initially after it came out. Drove me bloody mental. If I recall in my case, it was root motion was active. Try verifying that that is off on your imported animation

    [For the record, I'm referring to the positional rotation of the character, ORK doesn't play nice with Root Motion because of the character controller...as I understand it atleast]

    If it helps that most likely because of some sort of collider issue. But like you I'm not a programmer. So outside of turning off root motion on your animation that's about all the helps I can offer.
    Post edited by paulgswanson on
  • If I recall in my case, it was root motion was active. Try verifying that that is off on your imported animation
    Yes I´ve checked all my animations and don´t have root motion applied, I checked "Apply Root Motion" in my character prefab and it is Off, this issue only happens when I press key X or Y again, which I set for my draw sword animations, I think the problem could come from my event... I tried to block my character control, control maps, and camera, but nothing. I find the same problem again. :(
  • If this only happens when using the draw/sheath events, it's most likely something you do in there.
    I.e. either the animation or the mount object (or the combination of both). If your equipment has colliders (not set as triggers) attached, that could result in such a behaviour (e.g. if they collide with the collider of the player).
    It could also be mounting the equipment directly after the animation, e.g. try adding a small wait between them.
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited February 2016
    Yes I solved again, the problem comes from Event Settings, I should create 2 event actors: one for the object and another for the player,in Event actors select find Object and in search type must select name and write the name of your equipment viewer in Search Name, after this I should go to Mount Object event and select Weapon in Actor with the path where I have my weapon equiped and go to Target Object and select my player with path where the weapon is equipped, is something very easy but I did´nt fall in that one little detail. I will create a short tutorial in trips and trick section where I explain at length how to do it.

    Otherwise my character animation sometimes loop the walk animation when I raise my control maps key, I don´t know if this issue comes from the root motion, I´ve seen in my character settings and it is off, I´ve checked the other imported animations and I see all root settings are off, I will give a try and see where this issue would come.
    Post edited by berbelias on
Sign In or Register to comment.