Search Unity

ArcReactor procedural ray generator

Discussion in 'Assets and Asset Store' started by CatsPawGames, Jun 4, 2014.

  1. Superrodan

    Superrodan

    Joined:
    Nov 10, 2013
    Posts:
    10
    Ok, so I found a bug on my end that was causing problems. The loop was only being called sometimes.

    One thing I will leave here so other people debugging similar problems know, for some reason when I was running my game in Scene Mode instead of Game Mode, the lasers didn't go away unless I clicked something else. Not sure what caused that but I was debugging in scene mode. When I went into the game mode they did indeed vanish once the lifetime ran out.
     
    Last edited: Mar 14, 2016
  2. wightwhale

    wightwhale

    Joined:
    Jul 28, 2011
    Posts:
    397
    I'm having quite a bit of delay when using the arc ray for my gun's laser. I'm just instantiating one of the prefabs from the demo. Would it be better to have the laser set to playback clamp and never delete it?

    Also 2nd question, I modified the simple laser to be small and to be a targeting laser of sorts but I'm not having it show up at all on the ps4.
     
  3. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Sorry for the delay in answering.
    Delay is most likely due to laser being almost invisible in the beginning (when width and color values are almost zero). Try increasing slope curvature of size curves and color gradients.

    Sorry, but I can't test it on PS4. Can you provide a debug log or something similar?
     
  4. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.7 has been uploaded and is currently awaiting approval. New version is available only on Unity 5.3 and newer.

    Changes:
    • Added pool manager for optimized performance, especially on mobiles
    • Integrated Launcher and Launcher2D components with pool manager
    • Added new playback types: pingpong_once and pingpong_clamp_once for use in continuous rays
    • Rewritten gun controller in DemoScene1 to use new playback types for continuous rays
    • ArcReactor now sends playback messages even on "once" playback type at the end of the lifetime, right before destruction
    • Completely rewritten Shuriken emission (increased performance, better compatibility with Shuriken settings)
      • Removed randomization override options from Emission Options (ArcReactor emission now stays true to all Shuriken options)
      • !! Possible prefab-breaking
        • !! Emission options: Changed startColorByRay bool option to rayColorInfluence float (default value is 0.5)
        • !! Emission options: Changed Shuriken particle system definition in Emission Options from GameObject to ParticleSystem to avoid GetComponent calls
          !! Make sure to check your emission options if you use particle emission in your prefabs and re-drag-n-drop your systems
     
  5. ixikos

    ixikos

    Joined:
    Jun 21, 2013
    Posts:
    26
    Hey,

    I am getting some graphical issues with VR as well. I am using the Vive. Not sure how I can help you debug this, let me know :)
     
  6. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello, can you describe those issues?

    I have Oculus DK2 so I might be able to replicate them.
     
  7. eroberer

    eroberer

    Joined:
    Nov 18, 2013
    Posts:
    8
    Potential bug: I'll be looking into this more, but it looks like when a ray is pointing straight up/down, the sine wave oscillation option doesn't cause any options. This sort of makes sense from my recollection of trigonometry, but would it be possible to add a check for this, and flip to a cosine wave if the ray is straight up/down?
     
  8. eroberer

    eroberer

    Joined:
    Nov 18, 2013
    Posts:
    8
    Also, a simpler way to make a continuous ray would be nice. I have an area where I *always* want a ray with the exact same intensity, and I haven't actually figured out how to do it yet, but it seems like there could be a "continuous" option added to "loop/pingpong/clamp/once".

    I'm trying to take the PlasmaRay from Demo1 and make it continuous with the exact same intensity, and I just haven't figured it out yet.
     
  9. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    You can manually set oscillation normal to any vector (oscillation normal parameter of ArcReactor component). All trigonometric calculations are done relative to it, not global space. So, in your case, there's 3 alternatives:
    • point oscillation normal along x or z axis instead of y axis
    • change oscillation normal depending on orientation of your weapon
    • parent your ray to some object and check "local oscillation space" toggle on, then orientation of that object will be included in calculations
    Version 1.7 have a very simple mechanism for continuous rays, and Demo1 scripts have been rewritten to provide example of usage of said mechanism. Note that you need unity 5.3 or higher to download v1.7, older version of Unity get v1.6.

    P.S. Just noticed that you want a constant ray that just hangs there, and not for use in continuous weapons (if I understood correctly). In that case, most obvious way of doing that would be to choose clamp playback type, and setup curves and gradients so that needed values would be at the end of lifetime (look at ray prefabs with "_continuous" suffix for examples of that if you're using v1.7). Then set lifetime to extremely low value (something like 0.01), that should do the trick.
     
    Last edited: May 22, 2016
  10. eroberer

    eroberer

    Joined:
    Nov 18, 2013
    Posts:
    8
    ^ Brilliant! The _continuous prefab helped, and the pingping_clamp_once option with a lifetime of 0.01 did the job. Also, setting the oscillation normal to be (0,0,1) fixed several problems for me that I didn't even think it would. I was planning to be up 2+ hours, and I solved all my problems in 5 minutes. Thanks! :)
     
  11. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Sorry. I'm trying to do something similar to eroberer but that doesn't appear to work for me.
    I'm basically trying to make all the other laser prefabs similar to SimpleLaser_continuous. But they all stop after a moment or repeat turning on and off.
    There's a lot of options, so I'm getting a bit lost on tweaking, haha
     
  12. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Take a look at "Playback type" parameter of ArcReactor component, what you need for continuous rays is "Pingpong_clamp_once" (more in-depth description is in the manual).
     
  13. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Yeah, I tried that. So I'm on the PlasmaRay prefab. I changed the playback type and nothing else. I have the _Arc attached to a _Launcher, and fire it with the ArcReactorDemoGunController. It fires in bursts instead of a steady beam
     
  14. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    You also need to setup curves and gradients the same way as in _continuous prefabs. Basically you need to leave only half of your curves and gradients, so that ray will be at its maximum size and intensity at the end of its lifetime(when it will be clamped).

    1) By "attached to a _Launcher" do you mean you put your prefab in the "Arc prefab" field of Launcher component? If not, do that.
    2) If you're using ArcReactorDemoGunController from Demo1, you need to switch "continuous" parameter on in corresponding slot of guns array.
     
  15. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Oh ok. I wasn't sure about the curves and gradients. Didn't know if that would change the whole pattern. I was thinking playback would just keep it continuous until stopped. Is that modifying something within the "Arcs" array or somewhere else like Ease In Out Options?

    1) And yes, I dragged the Arc prefab to the field in the Launcher component. The same way as in Demo1
    2) Toggling continuous changes it a little, but they still seem to toggle on/off
     
  16. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Playback will keep it continuous(clamped), but since non-continuous rays are invisible at the end of their lifetime, you will not see your clamped ray. You need to change Start and End size curves in size options, and Core curve and Start and End color gradients in color options.
     
  17. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    I have no idea how to reproduce it because it only happens occasionally. But randomly, I will test in the editor, and I will get spammed by this:

    Code (CSharp):
    1. MissingReferenceException: The object of type 'Transform' has been destroyed but you are still trying to access it.
    2. Your script should either check if it is null or you should not destroy the object.
    3. ArcReactor_Launcher.LateUpdate () (at Assets/ArcReactor/Scripts/ArcReactor_Launcher.cs:527)
    which references this line near the bottom of "ArcReactor_Launcher.cs"

    Code (CSharp):
    1. GameObject.Destroy(tr.gameObject);
    Any ideas what that is?
     
  18. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Do you use sticking behavior? Launcher creates helper GameObjects and, depending on behaviour, can parent these helpers to objects on scene that's been hit by a ray. If you then manually destroy object on scene(and all child objects, including helper), Launcher will try to destroy helper again, causing that error.

    As a workaround, change the line causing error to this:
    Code (CSharp):
    1. if (tr != null)
    2.     GameObject.Destroy(tr.gameObject);
    I'll try to replicate this and will include more in-depth fix in the next minor update.
     
  19. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    I don't use destroy in any of my scripts. I only enable/disable things. I'll add that condition and let you know if it happens again. Thanks!
     
  20. PrimeDerektive

    PrimeDerektive

    Joined:
    Dec 13, 2009
    Posts:
    3,090
    Hey there! Just bought this package and loving it. I do have a question though: is it possible to smooth out the spatial noise resetting? I really wish I could have the points along my ray move around randomly but with a limit, so they never move too far away of where they're "supposed" to be in their oscillation. Or, alternatively, have the spatial noise reset smoothly rather than snapping back like it does by default.
     
  21. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    In the current version there isn't any options of that nature, although you bring up a good point. I'll think about best way of implementing that and release a small update with that option.
     
  22. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    32
    Hey friend! I'm having some problems with the Arc Reactor Trail... I got this errors (uploaded image).

    And how I can turn-off the Trail? Its possible?
     

    Attached Files:

  23. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Disabling object with trail should turn it off, but there's some upgrades coming to Trail in the next version so it'll be more flexible.

    Not sure about the cause of these errors, more specific information about when they're appearing (or a test project) would be appreciated.
     
  24. Luiz_Thiago

    Luiz_Thiago

    Joined:
    Feb 27, 2013
    Posts:
    32
    What I'm doing is activating the arcReactor_trail in a coroutine that moves a vehicle.
    The order is this: enable arcReactor_trail > move the vehicle > disable arcReactor_trail. During this process, the error occurs...

    One thing strange is that the trail generated, is not getting "together" with the arcReactor_trail gameObject in the end... is there an kind of offset...

    Captura de Tela 2016-08-10 às 4.20.14 PM.png
     
  25. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Are you disabling just trail component or whole gameobject? Disabling just trail component can cause some unexpected behaviour. Other than that, it seems like a pretty straight-forward use of trails. I'll try to replicate these errors and get back to you.

    As for offset, it's hard to guess without access to the project. Most probable cause is execution order of movement.
     
  26. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    Is there a demo for VR or a free example for testing? I'd like to see how it looks and performs in VR before I spend money on another asset that may not be usable in VR. Thank you very much!
     
  27. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello, good suggestion regarding VR demo, I'll include one during next update.

    As for compatibility, I tested ArcReactor with Oculus DK2 and it worked fully. I didn't test it with any other VR sets, but it should work just fine on them since it doesn't use any fullscreen effects, and it uses standard linerenderer for meshes.
     
  28. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    Thank you very much for your consideration. "it should work" doesn't save me from spending 32.16 Euro on something I may or may not be able to use in VR. It's just a matter of minutes to find that out. So a demo is very much appreciated! :)
     
  29. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    55
    I'm having a problem with a delay as well. It's most definitely an actual delay, I'm using it for my weapons in a VR game and I and all of my players notice it and I either need to fix it or switch to a different system. Shooting directly at enemies right in front with a propagation speed of 10,000 will still end up missing moving enemies because the ray isn't cast until after the enemy has already moved out of the way, making players lead point blank targets which doesn't make sense. Is there any way to fix this?
     
  30. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I'll run some tests to see what's causing this, and contact you when fix is ready.
     
  31. BusterTheWizard

    BusterTheWizard

    Joined:
    Jul 2, 2012
    Posts:
    55
    Thanks. It's very slight, but it's noticeable when the game is in slow motion.
    Also for what it's worth, I'm using it a bit differently. I have bullet objects that are instantiated and the ray is launched in Awake() on that object. Could that be the problem?
     
  32. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.8 will be uploaded during this weekend, due to changes in LineRenderer and Shuriken particles, this version will be available only on Unity 5.5+.

    Changelog:
    - Added tool-tips in inspectors
    - Compatibility changes to LineRenderer and Shuriken due to Unity 5.5 release
    - Added "scaleLimit" parameter to SpatialNoise options that allows to set maximum deviation of randomized ray from it's supposed position
    - Added "tangentsFromTransforms" option for ray-binding type of effects (similar to proton packs from Ghostbusters)
    - Changes to Size options of ArcReactor_Arc component:
    -- onlyStartWidth bool changed to shape type enum since LineRenderer now supports width curves. If your arcs have this bool set to false, please set new parameter to "start_end".
    -- Deprecated inertia from Launcher (tangentsFromTransforms works better for that effect)
    - Improved performance of swirl oscillations
    - (fix)Dynamically destroyed Launchers no longer leave shape transforms behind

    Along with new version, first tutorials videos will be available on Youtube.
     
  33. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Hey there. I'm back, haha. So I'm trying to create a continuous laser that reflects. This is not fired by a gun or anything. They're essentially a constant laser being emitted from the walls.
    I modified SimpleLaser_continuous to keep going with lifetime 0.01 and clamp, I used the reflective launcher from the example scene and attached SimpleLaser_continuous instead of SimpleLaser_reflective. It works for the most part, except the angle off the mirror is really awkward. It's not even in contact with the actual cube mirror. Am I missing something?
    Thanks!
     

    Attached Files:

  34. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello. Try turning "snap segments to shape" on in size options of your arc - that should fix this. Overall, all hard-reflecting rays (like lasers) should have that option checked. Also you might have to decrease segment size if your ray reflects in tight spaces.
     
  35. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Oh wow. that worked pretty well, haha. Thanks!
    Also, is it possible to have a beam change color at certain collision points? Say for example you have a blue laser, and a yellow screen. If you shoot the laser through the window, it turns green. So up until the window, the laser is blue, but continues as green. Would I need to have a new green laser spawn at the collision and just have it follow the trajectory of the blue laser? Or would it be possible to tell the laser to start blue and turn green at a set distance determined by the location of the collision?
     
  36. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Currently you have to spawn new laser since only 2 colors (start and end) are supported. It is theoretically possible to apply color gradient with more than 2 colors to LineRenderer, although it would come with performance cost. I'll look into it and possibly integrate that in version 1.9 (it's too late to put that into 1.8).
     
  37. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Ah ok. I'll play with that then. Thanks!
     
  38. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Sorry I have another question. The laser shooting has a weird curve. It only happens when reflecting (the line is perfectly straight otherwise). But it only occurs on the portion of the laser before the reflect
     

    Attached Files:

  39. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Also... can lasers interact with each other?
     
  40. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Do you use Unity 5.5? They fixed that behavior of LineRenderer there. Also you can mitigate it by decreasing segment length/ increasing number of smoothing segments (all in size options).

    Only if you add colliders manually.
     
  41. KamiKaze425

    KamiKaze425

    Joined:
    Nov 20, 2012
    Posts:
    207
    Ahhh no. I only use Unity 5.4.1 at the moment due to some other plugins. But I started playing with the numbers. I can't get the reflection point perfect, but I fixed the curving line.

    And how would I add colliders manually? For example, when it reflects, I would want a collider on the reflected laser as well. So it would need to dynamically change lengths and also form on the reflected part.
    So I could put a collider between every segment (line renderer position array value) every frame. Or I could build a collider from one segment all the way to the segment at the point of reflection. Do those sound about right to you?
     
  42. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Dynamically adding colliders aren't that easy, but off the top of my head it would work something like this: I'd create a separate component to be placed on same gameobject as your Launcher. In update/lateupdate of this component I'd check Rays array of Launcher, access each arc systrem(arc variable) and check it's shapeTransforms array. If shape transform has collider it'll update it's size to be between this and next shapeTransform. If it doesn't have a collider - we add it to this transform. Destruction of colldiers should happen automatically since ArcReactor cleans up shapeTransforms after ray destruction.
     
  43. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.8 is currently awaiting approval by Asset Store.

    Changelog:
    • Compatibility changes to LineRenderer and Shuriken due to Unity 5.5 release
    • Added "scaleLimit" parameter to SpatialNoise options that allows to set maximum deviation of randomized ray from it's supposed position
    • Added "tangentsFromTransforms" option for ray-binding type of effects (similar to proton packs from Ghostbusters)
    • Changes to Size options of ArcReactor_Arc component
      • !!onlyStartWidth bool changed to shape type enum since LineRenderer now supports width curves. If your arcs have this bool set to false, please set new parameter to "start_end".
      • Deprecated inertia from Launcher (tangentsFromTransforms works better for that effect)
    • Improved performance of swirl oscillations
    • (Editor)Added tool-tips in inspectors
    • (Editor)Moved component self-check from Start() of ArcReactor_Arc to editor inspector
    • (Demo)Added scene selection, added UI hints, migrated from outdated UI system.
    • (Fix)Dynamically destroyed Launchers no longer leave shape transforms behind
    • (Fix)Removed dependence on ParticleSystem.IsAlive since it provided unreliable results
    • (Fix)Fixed artifact on instantiating new trail.
     
    Rowlan and hopeful like this.
  44. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Update on version 1.8: added ProtonPack prefab to demonstrate use of "tangentsFromTransforms"
     
    Rowlan likes this.
  45. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
  46. damdai

    damdai

    Joined:
    Oct 4, 2012
    Posts:
    5
    Looks like ArcReactorHit and ArcReactorTouch messages aren't being sent when Start Behaviour and End Behaviour are set to Immobile.
     
  47. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, it's because there's no raycasting going on with these behaviors - otherwise it would be counter-productive performance-wise. I understand the need for that combination though, so I'll make a toggle to enable raycasting with these options in the next update.
     
    Last edited: Dec 19, 2016
  48. damdai

    damdai

    Joined:
    Oct 4, 2012
    Posts:
    5
    In my case, I only need the hit checks to occur once, when the ray is launched, not a continuous raycasting as is currently happening in LateUpdate. In the meantime, I'm doing this check manually. Thanks for the update!
     
  49. Rowlan

    Rowlan

    Joined:
    Aug 4, 2016
    Posts:
    4,300
    Could you please do a simple video tutorial about how to make firing a prefab from a gun?
     
  50. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Yes, I'm in the process of making tutorials. This most likely be part 3 and released tomorrow.