Search Unity

[X-WeaponTrail]The best weapon trail solution for unity.

Discussion in 'Assets and Asset Store' started by shallwaycn, Aug 18, 2014.

  1. mcguinnessdr

    mcguinnessdr

    Joined:
    Sep 20, 2014
    Posts:
    26
    Hey, just add x-weapon trail to my game and it was creating two trail meshes. Is there a reason you set mInited to false in Start? Init already gets called in OnEnable, so forcing it to call Init again in Start creates a second mesh. I commented out the part in Start and it seems to work fine.
     
  2. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    emm..
    I do remember I added that tricky code for some reason....
    If you commented out that line, when you instantiate weapontrail from prefab may not work properly..
    sorry for the inconvenient I'll try to find a better solution.
     
  3. mcguinnessdr

    mcguinnessdr

    Joined:
    Sep 20, 2014
    Posts:
    26
    I have the weapontrail as a child of a prefab that gets instantiated, and editing that line out seems to work perfectly. I also had to edit out the line in Deactivate that disables the actual gameobject, as I have the weapontrail as a child of an object that gets disabled, but when I reenable the parent the weapontrail doesn't reenable. Hope that makes sense. I got it working in my case, but I assume it will break other use cases.
     
  4. Superhxm

    Superhxm

    Joined:
    Nov 16, 2012
    Posts:
    5
    Hi, I used this in VR with singlepass, but the trail become black. how to fix this?
     
  5. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hi, Sorry for the late reply.
    Currently I have no VR device to test it, But as far as I know it works with VR.
    Are you using the distortion material? I guess that may be the problem.(this material uses grab pass and that's not recommended because it only works under some specific project settings.)
    Try using other material, if the problem still exists please give me more detailed information.
    And if I didn't reply within 1 day please send me a email..
    Regards,
     
  6. GGA_Wafflez

    GGA_Wafflez

    Joined:
    Aug 16, 2019
    Posts:
    1
    veil right trail.PNG veil wrong trail.PNG Question about continuity on trails. I'm combining red and distort trails for my weapons. I was wondering if you knew the cause of why sometimes the distort falls behind the red, or looks smaller, even on a blank stage (distort pulls from the image behind, right?). Above picture is correct blend. Below is what sometimes happens. The end points are identical or for some moves I've put the red end point behind. View attachment 468635 View attachment 468638
     
    Last edited: Aug 16, 2019
  7. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hello,
    As far as I can see I think there are too problems in your weapon trail
    1, The background's color is too pure, the distortion may not take effect
    2, The distortion strength is too large, try reduce it in the material.
    as you said the distortion pulls from the image behind, but it also add offset to it, so in the second texture, the distortion is taken from other area which color is pure gray.
     
  8. childcat

    childcat

    Joined:
    Apr 16, 2014
    Posts:
    3
    Hello, Shallwaycn.
    I'm using your asset very useful.

    But I have a question.
    I am using XTrailWeapon in LWRP project.
    When you check the SRP option in XWeaponTrail 1.4.3 and use it, a new object is created in Scene called _XWeaponTrailMesh:|material(name).

    Did I set something wrong?
    Or is this your design intent?
    If this is your design intent, please let me know why SRP options require you to create a separate meshObject.
    LWRP is still too difficult for me.

    Please reply.
     
    Last edited: Aug 20, 2019
  9. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hello childcat,
    The XWeaponTrail uses Camera.OnPreRender() to draw the trail immediately, but this method not work in SRP, so in SRP the trail is rendered by mesh object but its rendering has one frame lag.
    Hope this helps,
     
  10. BillyPocky

    BillyPocky

    Joined:
    Apr 6, 2018
    Posts:
    2
    quick question, how to make trail only active when model attackt?
     
  11. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    just set the weapon trail game object's active state to false while not attacking should work.
    you need to set the state by script or animation event manually.
     
  12. ZhavShaw

    ZhavShaw

    Joined:
    Aug 12, 2013
    Posts:
    173
    Will there ever be an alternative distortion shader for LWRP?
     
  13. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    The distortion shader uses grab pass, but it seems the grab pass is still not stable in LWRP, in some Unity version may not work.
    Even it works with LWRP it's still not recommended due to the performance issue.
    There seems have some cheap solution for distortion, but I'm not sure if it works with LWRP, I'll take a try but it's not a priority task..
     
    ZhavShaw likes this.
  14. RTXRishu

    RTXRishu

    Joined:
    Feb 24, 2019
    Posts:
    6
    Hello, shallwaycn, quick question.

    Is there a way, through code or some settings, that I could make the trail 'disconnect' from the mesh it's attached to after a certain point?

    So basically, when I attack, I want the trail to do what it normally does, trail behind the sword, but when the sword's animation is done, I want the trail to exist in the world scene, even if my sword is somewhere else now, etc.

    As in, "trail disconnects from sword after attack animation completes".

    Any idea how I can do that?
     
  15. RTXRishu

    RTXRishu

    Joined:
    Feb 24, 2019
    Posts:
    6
    I can show you a reference video if you want.
    There's certain bosses in the game Sekiro: Shadows Die Twice that do this. They do a large slash that has a trail, but when the slash is done, the trail lines stay in the air for a bit and the sword doesn't add onto the trail.
     
  16. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hi,

    I'm afraid currently this is not supported.

    If you really want to do this you can add a "pause" flag in the Update() function, and set pause to true and force update to return when you disconnects the trail.

    However I haven't tested it yet.
     
  17. RTXRishu

    RTXRishu

    Joined:
    Feb 24, 2019
    Posts:
    6
    I use SRP. So should I pause both Update() and LateUpdate() since they both run a Pre/Post Render function?

    I'll try this tonight.

    Overall, though, great asset. Love it.
     
  18. RTXRishu

    RTXRishu

    Joined:
    Feb 24, 2019
    Posts:
    6
    I played around with it.

    I realized I don't need to pause Update(), I just needed to pause RefreshSpline() which is called in Update().

    Pausing Update() pauses the fade-time variables and the vertex updates for fade as well, which I still need to work.

    I used a "pause" flag, and changed the line of code in Update() to this:

    Code (CSharp):
    1. if (!pause) RefreshSpline();
    Then in Activate(), I added this:

    Code (CSharp):
    1. pause = false;
    I set pause to true through animation event.
     
  19. frontakk

    frontakk

    Joined:
    Jan 8, 2011
    Posts:
    292
    Hi,
    Is this asset also available on the timeline window?
     
  20. JeffG

    JeffG

    Joined:
    Oct 21, 2013
    Posts:
    85
    Any Plans on supporting HDRP?


    Edit: Kinda got it to work. Turn on option for SRP. I changed shader to the sample HDRP particle shader ParticleUnlitDistortion and its close to the standard Trail you have

    Edit 2: ParticleUnlitSoft seems the best
     
    Last edited: Aug 15, 2020
    StellarVeil likes this.
  21. Nikolat93

    Nikolat93

    Joined:
    Sep 5, 2016
    Posts:
    36
    is there anyway to make this only be affected by motion in local space? If my character moves while swinging, the trails will be affected by my character's movement and jump around a lot. Seems like a huge oversight for a first person melee combat game.
     
  22. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Couple of months ago I discovered the start of the trails aren't in sync with my animations and felt like a frame lag. Like the trails can't catch up to the blade. And the rest of the trail are like a frame average of the swing positions, making it muddy.
    I wanna clarify if anyone finding similar results and I solved it by moving 'MyPreRender(MyCamera);' line of the code and it's now working as intendent.
    I'm using HDRP currently
    Code (CSharp):
    1.         void Update(){
    2.             if (!UseWithSRP){
    3.                 return;
    4.             }
    5.           //  MyPreRender(MyCamera);
    6.         }
    7.  
    8.  
    9.         void LateUpdate(){
    10.             if (!UseWithSRP){
    11.                 return;
    12.             }
    13.             MyPreRender(MyCamera);
    14.             MyPostRender(MyCamera);
    15.         }
     
  23. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hi all,
    Sorry for the late reply.. I don't know why I didn't receive the reply notification from Unity since a long time ago..

    @lenzchu
    Thank you for the solution, I'll test it tonight, If everything goes well I'll update a new version soon.
     
  24. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    Has anyone tested this on mobile?
     
  25. shallwaycn

    shallwaycn

    Joined:
    Apr 3, 2012
    Posts:
    202
    Hi there should be no problem on mobile.

    Most of the users including me are using this tool on mobile project.
     
  26. gearedgeek

    gearedgeek

    Joined:
    Jun 19, 2015
    Posts:
    236
    That's good to know. Have you tried testing on some low end mobile phones?
     
  27. lenzchu

    lenzchu

    Joined:
    Dec 7, 2013
    Posts:
    15
    Hi again! I discovered multiple xWeaponTrail gameobjects lingering in the hierarchy when destroying or instantiating one of my weapons a couple of times. I'm not sure if I've been doing this correctly that results in this flood. Is there a way to clean this up?
    upload_2021-1-10_19-4-15.png

    Many thanks!
     
  28. zoomj

    zoomj

    Joined:
    Sep 8, 2020
    Posts:
    4
    Im using Unity 2020 ,shader: Xffect/displacement/screen only zhis one cant work, how can i fix it
     
  29. milkalazer2

    milkalazer2

    Joined:
    Jul 5, 2021
    Posts:
    1
    Hi, I am developing for VR, is there a way to the sword trail for locomotion, and only activate it during attacks?
     
  30. Sizzle182

    Sizzle182

    Joined:
    Feb 1, 2017
    Posts:
    1
    Hi, I'm running into issues where, at times, the trail will appear to begin from very far away. Almost like it's beginning from the origin or someplace else. Are you aware of the issue? Is there a workaround? Thanks!
     
  31. sharifmeagalli

    sharifmeagalli

    Joined:
    Apr 1, 2020
    Posts:
    6
    Can you do a HDRP shader for the distortion materials
     
  32. tlamiczka

    tlamiczka

    Joined:
    Sep 30, 2020
    Posts:
    6
    There's a very simple way how to do distortion material now :) (at least with URP 12+)

    If you use Universal Render Pipeline/Particles/Unlit material, you can now use Advanced option Distortion. See screenshot for possible setup how to do it (the most important thing is the normal map that actually does the distortion)

    Additional info is here https://docs.unity3d.com/Packages/c...ersal@12.1/manual/particles-unlit-shader.html

    (I'm very happy I can use this now, working with shader graph is pretty complicated)
     

    Attached Files:

  33. brendenguy

    brendenguy

    Joined:
    Nov 25, 2013
    Posts:
    7
    Hello! I recently purchased X-Weapontrail and it is not working for me either on the provided demo scene or in my game. There simply is no trail effect. I don't see any errors anywhere to indicate what might be going wrong. I am on Unity 2020.3.25f1 and URP 10.7. Any idea what I might be doing wrong?

    Also I should note that I am instantiating my weapon at runtime. I've confirmed that it has the X-Weapontrail prefab and it is activated, but nothing is happening.
     
  34. supermoof

    supermoof

    Joined:
    Sep 24, 2015
    Posts:
    48
    I use URP and I got it to work by checking 'Use SRP'
     
  35. JAKAMY

    JAKAMY

    Joined:
    Apr 21, 2015
    Posts:
    13
    Hi @shallwaycn , I bought this asset as it said it works with HDRP on the Unity Asset page description. Any official guide how to get it to work including the distortion effect?
     
  36. echolink

    echolink

    Joined:
    Apr 30, 2014
    Posts:
    5
    try check "Use with SRP" box to true
     
  37. echolink

    echolink

    Joined:
    Apr 30, 2014
    Posts:
    5
    hi @shallwaycn im using URP on Unity 2020.3 and 2021.2 and the distort material is pink. how to fix this?
     
  38. JAKAMY

    JAKAMY

    Joined:
    Apr 21, 2015
    Posts:
    13
    SRP box doesn't fix all for HDRP. Distortion shader doesn't work as it was advertised. It's highlighted to be an HDRP on the store page but it is not really. it is a bummer there is no real support. I am not into bad reviews, especially for a little update that could be done by the creator in little time to the asset... I'll consider this lost money then :-/
     

    Attached Files:

  39. solkyoshiro

    solkyoshiro

    Joined:
    Aug 25, 2021
    Posts:
    27
    And the website with the docs are down. So, I think that says everything right there.
     
  40. maxnguyen2711

    maxnguyen2711

    Joined:
    Jul 30, 2018
    Posts:
    1
    Help me! :( I have the trouble with curve sword. how can i solve this problem
    upload_2022-12-28_17-32-20.png
     
  41. JeffG

    JeffG

    Joined:
    Oct 21, 2013
    Posts:
    85
    For me, I changed the Activate() function.

    Commented out the Init and reset the mSpline instead


    Code (CSharp):
    1.             //Init();
    2.             foreach (var cp in mSpline.ControlPoints)
    3.             {
    4.                 cp.Position = CurHeadPos;
    5.                 cp.Normal = PointStart.position - PointEnd.position;
    6.             }
    7.  
     
  42. JeffG

    JeffG

    Joined:
    Oct 21, 2013
    Posts:
    85
    You just need to create the proper material. You can download the HDRP sample shaders in the package manager and that can give you many options.

    I have a couple done, This is one example
     

    Attached Files: