Search Unity

ArcReactor procedural ray generator

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

  1. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    No, you're not missing anything. The problem isn't in the particle system position though(since emission,including particle positions, is handled by ArcReactor), it's in the interframe blending algorythm(previous frame position of the 1st frame sometimes handled as (0,0,0)). I'm in the process of overhauling "under the hood" emission handling, so particles in 1.5 should be much more stable.
     
  2. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    Is it possible to prevent an Arc Reactor from auto destroying itself when it finishes? I have a laser effect that I'm freezing / unfreezing according to game events, and am trying to recycle the laser effect by setting the Elapsed Time back to zero when I want to reset the effect but the effect destroys itself. Am I just using the asset in an incorrect manner?
     
  3. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi. You're using effect absolutely correctly, just switch playback type to Loop to stop it from auto-destoying.

    Edit: Just thought more about this, I think I'll expand the playback system a bit. I'll add option of Clamp playback and message triggering on reaching end of effect lifetime.
     
    Last edited: Jan 17, 2015
  4. rxmarccall

    rxmarccall

    Joined:
    Oct 13, 2011
    Posts:
    353
    That would be very helpful to have a trigger to know when its finished its lifetime. thanks!
     
  5. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5 is almost here! All that's left is fire/ice particle textures.
    Changelog:
    - added playback messages
    - added Clamp playback type
    - added Size Multiplier variable which allows scaling ray system as a whole
    - changed left-over particles system behaviour(fixed null reference errors, better perfromance)
    - changed particles emission mechanism (more stability in emissions, randomization support)
    - fixed interframe interpolation for emission shape (no more rogue particles at the start of the system)
    - added new ready-to-use ray prefabs - fire ray, ice ray and oscillating plasma ray
     
    hopeful likes this.
  6. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5 uploaded to Asset Store. Will be available in about a week.
     
    Last edited: Feb 3, 2015
    hopeful likes this.
  7. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Plans for version 1.6:
    ArcReactor_Trail - alternative to ArcReactor_Launcher, it's a trail system that's utilizes ArcReactor ray systems as trails.
     
  8. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5 is avaliable on Asset Store.

    Changes:
    - added playback messages
    - added Clamp playback type
    - added Size Multiplier variable which allows scaling ray system as a whole
    - changed left-over particles system behaviour(fixed null reference errors, better perfromance)
    - changed particles emission mechanism (more stability in emissions, randomization support)
    - fixed interframe interpolation for emission shape (no more rogue particles at the start of the system)
    - added new ready-to-use ray prefabs - fire ray, ice ray, oscillating plasma ray

    15_forums.jpg
     
    seansteezy likes this.
  9. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Glad to announce that ArcReactor v1.5 was tested on Unity 5 and is fully compatible.
     
    twobob likes this.
  10. emiaj715

    emiaj715

    Joined:
    Jan 16, 2013
    Posts:
    20
    Hey, I'm using this for a game that we are releasing soon and noticed some issues on certain android devices. It seems like the rays are not rendered at all on Galaxy S4 and some other devices. It seems like it might be related to the android system that the device is running, I'm really not sure. Would really appreciate some info on this and if there is any fix to get this working. Thank you, it's a great tool besides that and love how its looking in unity and iOS. Just need it to be working on android too!
     
  11. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hm, that's strange. Can you tell what versions of Andoid have this issue? I just tested it on 4.2 - it works fine.
     
  12. emiaj715

    emiaj715

    Joined:
    Jan 16, 2013
    Posts:
    20
    Seems like Galaxy S4 - 4.4.2 is having issues.
     
  13. emiaj715

    emiaj715

    Joined:
    Jan 16, 2013
    Posts:
    20
  14. Hatsuko

    Hatsuko

    Joined:
    Oct 14, 2013
    Posts:
    5
    Hi,
    I have bought your asset and it's super good!
    Though I currently have one question. How do I detect collision like OnCollisionEnter()?

    In page 1 you said:
    >>That's strange, this method(as well as ArcReactorReflect) should be called each frame the ray hits object. I just quickly tested it and it works as intended. Can you post an example of your usage of this event?

    So is there a way I can detect just the first frame the ray hits object?
     
  15. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi.

    In current version, you can use bool flags for that. For example, look at ArcReactorDemo3Mirror.cs script. I plan to implement OnHitStart and OnReflectStart events in version 1.6
     
  16. Hatsuko

    Hatsuko

    Joined:
    Oct 14, 2013
    Posts:
    5
    I tried your suggestion and it worked! Thanks!
     
  17. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I'm glad to hear that. Be sure to tell if you have further questions regarding using ArcReactor
     
  18. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.5b uploaded to Asset Store, contains minor compatibility changes.
     
  19. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
  20. OneShotGG

    OneShotGG

    Joined:
    Nov 16, 2012
    Posts:
    225
    Hey I got the ray firing right in my 2D game but it wont hit 2D colliders (since it is in 3d space) how can I fix this?
     
  21. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    Please send me your email in PM or to leonidmv@gmail.com , I'll send you Launcher2D component to use instead of Launcher - this component use 2D Physics instead of 3D. It'll also be included in version 1.6 of ArcReactor along with new 2D demo scene.
     
  22. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    It seems some Android devices have problems with rendering rays when "Fade" option (inside Size options) is disabled. If you're experiencing this problem, enable fade (you can set fade coef to 0.01 if you don't want fading on your rays) - this should solve the issue for now. I'll include a real fix in version 1.6 (expected to come in about 2 weeks).
     
  23. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    HellFireKoder and twobob like this.
  24. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I so love this package. Have yet to actually roll it out in a title, but it is a lot of fun.

    nice demos too
     
    HellFireKoder likes this.
  25. ConfirmCrit

    ConfirmCrit

    Joined:
    Nov 26, 2013
    Posts:
    7
    I'm working on a game where I currently have an electricity beam firing like so, whenever an asteroid passes the ship, a beam comes from the ship and hits the asteroid. When it's out of range, the beam turns off.

    I saw the documentation with clamp and freeze, so I can get most of the effect I want, but would there be a clean way to move the location of the start and end of the beam cleanly?

    The beam in my game now has no problem rotating around, as two parameters on it are start and end. I simply update those two every frame while it's on, and it works.
     
  26. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Since your beam uses raycast behavior, easiest way to do what you want would be using Launcher component - just parent it to your ship and invoke Launch method, it will determine ray position through raycast and generate ray system (more info in the manual). If you're using 2D colliders, then please send me email to leonidmv@gmail.com, and I'll send you Launcher2D component that works with 2D physics.
     
  27. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    I have a problem on Unity 5 , Reflection Example Scene doesn't work the reflect effetct
     
  28. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Is there any error messages? Please try to import ArcReactor into empty project and try to run reflection example scene there. If it doesn't help, please send me email to my leonidmv@gmail.com and we'll try to further address this issue.
     
    Danguru likes this.
  29. Danguru

    Danguru

    Joined:
    Jan 14, 2011
    Posts:
    27
    I tried and it's work , i need to check in the other project what appen but it's ok!
    Did you do a 2d version ?
     
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    hi.

    When I do a very simple, one laser, implementation (using pretty much the defaults) I note a lot of per-frame garbage.

    upload_2015-5-4_17-52-14.png

    at this point in the game it is in fact doing almost nothing. shooting from one pixel to the next, no lights.
    Rainbow laser, so 4 arcs to it, absolute minimum load.

    If there any chance you might have a look at trimming this per-frame noise so that I can look to put this on mobile in the future? I suppose I can freeze the laser when not operating, will give that a go next but the garbage is a wee bit heavy regardless

    Much obliged.
     
  31. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi.

    I though about optimizing some areas of ArcReactor - mostly minimizing garbage collection need - but there's still going to be some CPU overhead, especially if you're using particles.

    General tips for CPU optimization: reduce particles count, segments count and smoothing segments count. Segment reduction works best if your rays use heavy amount of randomization and oscillations.
     
  32. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Hi. It's the garbage I want rid of.

    The cpu I am not as worried about as I will only ever have one laser probably.

    just so I am clear does that mean these works (tidying up garbage) are scheduled?

    Many thanks
     
    Last edited: May 4, 2015
  33. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    I plan to include optimized version in 1.6 release which is, to be honest, long overdue. I plan on uploading it to asset store in 2nd or 3rd week of May.
     
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Nice one.

    Thank you kindly
     
  35. seansteezy

    seansteezy

    Joined:
    Nov 28, 2013
    Posts:
    122
    Hey there! I have a small question and if it's been answered before you can just point me to the thread # or something. I scanned through it but didn't see this specific question.

    I just want my ray to not pulse. Like, a solid laser, I'm using the simple laser prefab, and it turns on and off and loops, but I can't figure out how to just make always on? I'm using it like a weapon laser sight for a top down shooter. Do you know what settings I can use to make it happen?

    Thanks for your time!

    -ss
     
  36. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hi.

    Just set "elapsed lifetime" to position where ray looks most suitable (usually half of lifetime is fine) and turn "freeze" on.
     
    seansteezy likes this.
  37. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    What is the "right" way to disable a ray but leave it "in place" after it does a loop or two.
    I currently just hacked the code to automatically detect a null in the 2nd Tranform slot (When 2 transforms are indicated) and make the Rays "target" point to the Transform.position of the 1st slot (or "source"). This allows me to simply rip out the "Target" transform and the ArcRay will automatically reduce itself to the tiny flare at the end.

    Whilst this is actually a very convenient mechanic I wondered how others managed it.
    It's probably very simple but along the way I did fail to find a "DoNothing" toggle (and still maintain the script as "Active")
    Ta.

    Code (csharp):
    1.  
    2. public void FillResultingShape()
    3. //snip
    4.   for (int i = 0; i < resultingShape.Length; i++)
    5.   {
    6.   if ((shapeTransforms.Length > i) && (shapeTransforms[i] != null))
    7.   resultingShape[i] = shapeTransforms[i].position;
    8.   else
    9.   {
    10.   if (shapeTransforms[i] == null)
    11.   {
    12. // we presume that at least the origin point is set...
    13. // add extra defensive logic here if you wish
    14.   resultingShape[i] = shapeTransforms[0].position;
    15.   //  Debug.Log("Ray reduced to single position");
    16.   }
    17.   else
    18.   {
    19.   resultingShape[i] = shapePoints[i];
    20.   }
    21.   }
    22.   }
    23. //snip
    I guess I want "Once" playback on a trigger without a deletion?
     
    Last edited: May 5, 2015
  38. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Unfortunately there's no "Do nothing" toggle - you can freeze rays no problem, but disabling only visualization isn't that simple. One way of doing it would be disabling LineRenderers alongside turning off particles emission - you might want to expose lrends array as public for that.
     
  39. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Yeah. Just actually "not deleting" at the end of the the loop/once and having a "Trigger again now" value would do the job fine?
    It's pretty much what I have now I guess. aside from disabling the individual guts recursively.


    okay I will look at protected LineRenderer[] lrends; then
    And add a "Don't Delete" fuzzy function and see how it plays out.
    Seems like this would be a pretty "usual" request, so, worth investigating.
     
  40. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    If that's what you need, easiest way to do it would be using "clamp" playback type. Most rays are invisible at end of their lifetime, so they'll just freeze after play. When you need to show it again, just set elapsedLifetime to zero and freeze to false.
     
  41. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I am basically trying to use one ray, repeatedly, and "disable" it at the end of it's playback until the next time.

    The Clamp solution is perfect. I will do that instead. Probably should read the manual again and stop wasting your time, its been several months since my last confession at the church of your docs. You have better things to do than waste time on me.

    Thanks for the tip on clamp, (works nicely in conjunction with the Transform hack above)

    Have a great day.

    Code (csharp):
    1.  
    2. public class LaserManager : MonoBehaviour {
    3.  
    4. public static ArcReactor_Arc arc;
    5. private Transform player;
    6.  
    7. void Awake () {
    8.    player = GameObject.FindGameObjectWithTag("Player").transform;
    9.    arc = player.GetComponentInChildren<ArcReactor_Arc>();
    10.    LaserManager.arc.enabled = false;
    11.    LaserManager.arc.playbackType = ArcReactor_Arc.ArcsPlaybackType.clamp;
    12.    }
    13.  
    14. public static void shootLaser(Transform target)
    15.    {
    16.    Transform[] trans = LaserManager.arc.shapeTransforms;
    17.    // when our target despawns the ShapeTransform[0] takes over...
    18.    trans[1] = target;
    19.    LaserManager.arc.enabled = true;
    20.    LaserManager.arc.freeze = false;
    21.    LaserManager.arc.elapsedTime = 0;
    22.    }
    23. }
    24.  
    25. // And....
    26. public class SomethingElse: MonoBehaviour
    27.    {
    28.      public void disableLaser() {
    29.      LaserManager.arc.enabled = false;
    30.    }
    31. public void OnMouseDown()
    32.    {
    33.      shootLaser(transform.position);
    34.      Invoke("disableLaser", .7f);
    35.    }
    36. }
    That sort of thing should work fine then, thanks
     
    Last edited: May 5, 2015
  42. seansteezy

    seansteezy

    Joined:
    Nov 28, 2013
    Posts:
    122

    Awesome, thank you! I should have figured that out but I appreciate the help!
     
  43. coutlass-supreme

    coutlass-supreme

    Joined:
    Feb 21, 2014
    Posts:
    22
    Hi,

    I have a question about shapes.

    Im making a square, im using 5 points(4 for the square and a duplicate of the first to close the shape) but i get something like this:

    upload_2015-5-7_0-25-53.png

    it skips the corners. Only the points where the shape closes are correct.

    I thought it could be something like the interpolation property but i dont see a way of getting the corners to display without those joints.

    what do you recommend?

    thank you for your time.
     

    Attached Files:

  44. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    1) You don't need to use a duplicate point, just set "closed shape" on.
    2) Set "interpolation" to linear. There's 2 interpolation option - one in main settings that defines general shape, and one in size option of arc that defines smoothing of that particular arc. You'll need to set both to "linear" to get the ideal square.
    3) Check "Snap segments to shape" in size options.
     
    Last edited: May 7, 2015
    twobob likes this.
  45. coutlass-supreme

    coutlass-supreme

    Joined:
    Feb 21, 2014
    Posts:
    22
    hi,

    thank you for the fast answer.

    i also had to lower the smoothing segments and minimum number of segments.

    thanks.

    upload_2015-5-7_8-53-25.png
     
  46. coutlass-supreme

    coutlass-supreme

    Joined:
    Feb 21, 2014
    Posts:
    22
    hi,

    im trying to add shapepoints through code after instantiating and i get index array errors. Is this a posibility or am I doing it wrong?

    This also has to do with adding shapepoints or modifying the shape at runtime. Can this be done?

    I encountered these problems because im using this class as a sort of linerenderer. I saw its on top of the native linerenderer, but with many issues and functionalieties solved.
     
  47. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    You should be able to access shape arrays through code at runtime no problem. Array index error most probable cause is you're trying to access indexes higher than array size allows. Can you show relevant parts of your code? Or you can send me email with that info.
     
  48. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    455
    Hello, I have bought this some time ago, and this is really awesome and amazing, and now I decided to use it, BUT after trying to read the well done manual, it seems that all is towards making your own rays or modify existing rays, but I could not find HOW to use the included already made prefabs, I mean how to integrate them in my own project

    What I want is to have a spaceship in the air and that it cast a vertical ray from the bottom of the spaceship to the floor and want that the ray is ALWAYS active and does not switch off, so how do you configure for this?

    In the manual is put

    To create your first arc, create empty game object (“Game object” -> “Create empty”) and drag “ArcReactor\Scripts\ArcReactor_Arc” script to it. Alternatively, you can add “Rays system” component from “Arc Reactor Rays” menu.

    You should see arc settings in the Inspector:

    I see correctly the settings in inspector, but modifying them nothing happens on the scene, and can´t see what the changes are

    My problem is that when I do this and try to put any ray in the scene, nothing is shown, this new gameobject does not show anything in the scene, so I do not know where it is, I mean how big it is and where it begins and ends, and all seems to be invisible, so I do not know how to position the ray in the right place and that is generated correctly and be seen when hitting play, as know nothing happens.

    I have tried to use any of the prefabs included and also seems that nothing happens

    Surely is my fault and mistake that I am missing something and have not understood how this arc reactor works, please can you be so kind how to use the prefabs included to be integrated in my own project and make the vertical ray from spaceship to the floor?

    UNITY 5 COMPATIBLE?

    I have also another problem

    I have created a new empty and clear project in Unity 5.01 Personal Edition, and have loaded the Arc Reactor Ray Generator 1.5b from May 17 2015, so surely is the latest, BUT I when I try to load the Demo1_Fps_And_static effect, all seems to be black without any effect showing, and I have seen that many things in the Hirerachy are desactivated, and when I turn them on, something works BUT not in the same way as the demo was working in the Unity 4.6

    As it seems that this have been updated to Unity 5, I wonder why the first demo does not work right?

    Here below I put a screenshot of what I get when I hit play after loading the first Demo scene

    There is no errors shown on the console

    The other two demos work without any problem

    I am using Mac OS 10.9.5 Maverick with Unity 5.01
     

    Attached Files:

  49. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Hello.

    1) Please understand that ArcReactor component in itself is a visualizer, you need to provide a shape for it to show. There's multiple way of providing shape: fill out ShapeTransforms or ShapePoints array, or use ArcReactorLauncher component. In your spaceship case, easiest way would be to parent Launcher to a spaceship, point its Z-axis down, and invoke LaunchRay() method. If you're using premade prefabs, you'll also need to make them continuous. To do that, just set "freeze" on and set elapsed lifetime to a half of total lifetime (usually 0.5). You can also make your own continuous prefabs by using playback types "clamp","pingpong" or "loop".

    2) Did you try hitting mouse button or "Q" key? Because by default 1st demo is a FPS demo, so rays are your weapons which are switched by number keys and activated by mouse. Disabled objects are static showscase that's disabled by default because it's very bright and distracting, but you can toggle it with Q key. I'm sorry if it's not intuitive enough, I'll include a disclaimer in GUI.
    If you tried it and it doesn't work, only changes between Unity 5 and Unity 4 versions of this scene are materials and skybox, and it's been tested on Unity 5 on different machines multiple times. Are there any error or warning messages? Also, a screenshot of "something works" would be appreciated - maybe there's a shader issue on macOS. Also, you can try downloading Unity 4 version and opening it in Unity 5 - there's no errors caused by conversion, so it's totally safe, and scripts and shaders work on both versions.
     
  50. CatsPawGames

    CatsPawGames

    Joined:
    Jun 4, 2014
    Posts:
    443
    Version 1.6 is ready, list of changes:
    - Fixed constant GC generation by idle Launcher
    - Added Launcher2D which supports 2D colliders
    - Added simple 2D game demo scene with reflections
    - Added ArcReactor_Trail component - alternative to Launcher. It will draw shape based on movement of GameObject
    - Added trails demo scene
    - Fixed Android fade bug.

    I'll upload it for review after necessary documentation & presentation updates.
    image_trail_sample_for_forums.jpg
    image_2d_sample_for_forums.jpg