Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

MegaWires - Easy Dynamic Powerlines

Discussion in 'Works In Progress - Archive' started by SpookyCat, Dec 9, 2013.

  1. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685

    Introducing MegaWires
    MegaWires is an Editor extension that makes it very easy to add fully dynamic wires, cables or ropes to your games. Draw out your path and select your pole type from one of the 42 included or use your own pole objects and then with one click have full physics controlled wires strung between all the connections, even add a Wind object for even more realism.


    The system comes with various components that make adding dynamic wires, ropes or cables to your scene easy. You can either select your objects that already exist in the scene and then have wires created between them, or you can lay out a complete path and ask the system to position your selected pole object along that path, you are free to add extra path points or move points around and the system will automatically update the wires for you. If you are a user of our MegaShapes system you can even use the splines created in that package for positioning your poles. The system allows you to have the poles automatically snap to the surface of any objects that are under it and there are options for adding in variations to positioning, rotation etc to give just the look and feel you are after.


    There are helper scripts included that allow you to define wire connection points on any object, and you can define any number of connection points for complex wiring cases. Or you can use one of the different pole types included in the system, we have included 6 different pole objects each one with 7 different textures given a total of 42 different pole types to choose from. We have also added extra objects such as supports and two types of transformers to add extra detail to your scene. Those included poles come with wire connection points predefined so making fully dynamic wires in your scene is just a matter of a couple of clicks.


    Once you have your wires in the scene you can add the Wind object to allow those wires to sway and move realistically to add further interest to your project. You have complete control over the Wind force and direction as well as turbulence and strength and direction variations. Also included are two helper scripts to allow you to attach objects to your wires, so making it easy to add birds perched on the wires or to hang swinging rigid body objects that cause the wires to sag under the weight.


    The system uses a heavily optimized custom physics system for super fast performance, plus the system has a LOD system to allow you to disable any wire based on distance from the camera, but the system will automatically handle waking up of any wires that are sleeping if a pole they are attached to moves etc. And along with the meshing options you can have wires all over your scene with little or no CPU use making it suitable for mobile game projects as well.

    Included Objects
    Included with MegaWires are 6 different pole objects and for each one you can choose from one of seven different materials giving in total 42 different poles ready to be used in your scene, also included are some extra objects such as support poles and two different types of transformers you can add to your poles in the scene. We hope to add more objects and pylons to the system over time. All the included pole objects have wire connection points pre defined for you.


    Included Components
    As well as the 42 different pole prefabs included with the system comes with various scripting components to extend the functionality of the system or make the generation or wires and poles easier, below are links to the various included components that come with MegaWires.

    Features
    Some of the features of the MegaWires system, we plan on adding new systems and more features as well as more pole object types, textures and support objects.
    • Super Fast custom Physics
    • Works with All versions of Unity
    • 42 Pole Objects included, 6 pole types with 7 textures
    • Full source code
    • LOD system to disable wires
    • Automatic waking of physics on pole movement
    • Wind system with turbulence and variation
    • Attach Objects to Wires for swinging signs
    • Path Drawing system
    • Complete control over mesh creation
    • UV Mapping options
    • Have wires detach and attach themselves

    MegaWires has been submitted to the Asset store and awaiting approval, more information plus complete docs on all parts of the system can be found on our Website The introductory early adopter price is expected to be $45

    Videos
    Quick and easy adding of poles and dynamic wires to your scene.


    Some of the Physics and Meshing options.


    Dynamic interaction and hanging objects.
     
  2. treshold

    treshold

    Joined:
    Nov 9, 2013
    Posts:
    225
    Looks awesome! And if the early adopter price is below 50$ it's quite a deal :)
     
  3. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Thank you :) As with all our previous assets (MegaFiers over 100 updates with new features and MegaShapes 50 updates for example) we expect to add more features over time as well as new pole object types etc. Tony is busy doing a nice little demo scene which has shown up some more features we could add and we are using all the systems we release in our game projects so as we find more uses and ways to do things they filter back to the released assets.
     
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    Ooo nice, is this out yet? If not do you have a date?
     
  5. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
  6. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    We have just submitted an update to the asset store and on our website. This brings an improvement to the Plant Poles system where it will not preserve the existing wire params if you update the pole planter params, so before if you built a wire and then adjusted all the physics params etc then changed a pole planter way point those settings were reset, now they aren't making it much nicer to tweak things. Also if you had added you own child objects under the plant poles objects they were destroyed, now they aren't.

    Changes in v1.03


    • Wire window now shows arrows and spacing details.
    • Pole Planter now preserves wire settings if you change any settings on exisiting wire.
    • Pole Planter will only delete Wire objects from the children list so you can add your own child objects without them getting destroyed if you update the Pole Planter settings
    • Objects attached to planted poles will now work correctly if plant poles values change.
     
  7. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    Just purchased your wires asset and it works wonderfully, thanks again for another quality system.
     
  8. janpec

    janpec

    Joined:
    Jul 16, 2010
    Posts:
    3,520
    Cool asset quite unique thing to develop as modular asset system hehe.
     
  9. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Thanks Mike glad you find it useful.

    @janpec - Yeah very niche never going to make a fortune but it was a system we had for our own game so on a whim put it together as an asset in case someone found it useful.
     
  10. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Just submitted a small update to MegaWires to the Asset Store, this fixes a problem when using the system with MegaShape splines. If you do have MegaShapes and would like to plant your poles along a spline then you just need to change the #if false to #if true in the MegaWirePlantPoles.cs and MegaWirePlantPolesEditor.cs scipts to enable that support. I also added the docs as a pdf to the asset.

    Changes in v1.04
    • Fixed the bug that stopped the poles being planted on MegaShape splines.
    • Added PDF docs file.
     
  11. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Submitted a small update to the MegaWires system which removes the warnings generated when importing the asset into a 4.5 project.
     
    John-G likes this.
  12. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    megagrave1.jpg
    If anyone would like to see an example of MegaWires being used in a game then take a look at Broken Window Studios Horror Experience game Grave, you can download a demo of the game from their website and if you like what you play you can help support the development of the game.

     
  13. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    A small update is now available in the AssetStore, this fixes a couple of small bugs and also adds support for our MegaFlow system to be used as a wind source for the wire movement
    Changes since v1.04
    • Added support for using MegaFlow sources as wind inputs MegaWireFlowWind.
    • Fixed the bug that stopped changes in the stretch value on the plant poles being passed to the actual wires.
    • Fixed warnings about obsolete methods in Unity 4.5 and 4.6
     
    John-G likes this.
  14. John-G

    John-G

    Joined:
    Mar 21, 2013
    Posts:
    1,114
    Thanks for the update.
     
  15. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    You will need version 1.09 of MegaFlow to be able to use it, hope to have that released very soon.
     
    John-G likes this.
  16. TimeWalk-org

    TimeWalk-org

    Joined:
    Nov 3, 2014
    Posts:
    38
    I am loving MegaWire, but to improve performance, I'd like to disable the physics/wind once I've built my wires. How do I do that? If I check "Disable All" under the Mega Wire script, it seems to re-check itself at runtime. I see no way to "bake" the wires in once they are calculated. Sorry for the ignorant question, but I don't see anything in the instructions on this.
     
  17. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Good to hear you are liking the system. The Disable All value is a static value so Unity will not serialize that when play is hit, you can just add a simple little script to set the value as you want it, or you can use the 'Enabled' option for each wire set to turn off all the physics. The system does include a disable on distance option which will automatically turn on and off the wire physics depending on the distance of the camera from the mid point of each span between poles.
     
    John-G likes this.
  18. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    It's an interesting system, but I have to figure out more about it.
    I like that you included the Todo list. I am especially interested in "break a wire" and "Noise option for thin wires" sounds interesting as well.

    But I am disappointed that the system does not seem to work with physics. That was one of the major points I bought it.
    Do you plan advanced collisions in the near future? At least some way to handle various floors/heights on certain areas or to work with an uneven terrain.
     
  19. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    @EyecyArt - Thank you for the purchase, I hope you get some use out of the system. The system uses its own physics system to keep it as fast as possible, using the unity physics system with the required joints between masses and the timestep required to stop the physics system exploding would make it a lot slower. The system does have a basic floor place collision system but it is quite limited I admit, the system was built though to build wires of the ground :) It would not take too much to add an option to use a raycast collision system to allow collision with Unity colliders, I will put that on the todo list and see if I can get that in the next update.
     
  20. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    @SpookyCat Thanks for taking it into account, and yes I understand that it is not that easy. Actually I prefer good performance.
    I had a look at the relevant code and it isn't as complex as I thought. I was able to simply manipulate the height based on the "mass" position. That will do it for a start :)
    I just want that the rope is floating across static objects, such as roofs.
     
  21. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Just submitted an update to the Asset Store and our website, this adds the option to choose raycast collisions for the wires, you can also select the layer mask and add a collision offset to keep your wires off any surfaces.

    v1.10
    • Added new collision option to use raycasts for better collisions with the world
    • Added layer mask option to raycast collision to choose layers to hit.
    • Added offset value for the raycast collision system to allow you to raise the wires of hit surfaces.
     
    McDev02 likes this.
  22. McDev02

    McDev02

    Joined:
    Nov 22, 2010
    Posts:
    661
    @SpookyCat Thanks this is a good improvement. There just is an issue which occurs on hard edges. I tried to solve it with damping and other values but these have a minor effect. Do you have an idea for how to solve this?
    I am not sure if it is caused by the collision check or by the physics of the rope.
     
    Martin_H likes this.
  23. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Took a look, the problem happens because the wires are a little stretchy, so as the mass drops of the side the physics tends to draw the mass back towards the previous mass so on the next frame or so it is inside the collider so it snaps back up. Until I can think of a fix for that a small slope instead of sharp edge would stop that from happening.
     
    Last edited: Nov 10, 2015
    McDev02 likes this.
  24. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    637
    Hi @SpookyCat how can I stop the wires from casting shadows?
     
  25. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    @deverolirc - If you uncheck the 'Hide Spans' option in the Inspector on the Wires object if will show all the wire gameobjects in the inspector, you can then just select them all and turn of the Cast Shadows option as normal.
     
  26. o1o101

    o1o101

    Joined:
    Jan 19, 2014
    Posts:
    637
    @SpookyCat Thanks for the support, great asset by the way, works flawlessly, also noticed it was used in Rust if I am not mistaken!
     
  27. BrokenVector

    BrokenVector

    Joined:
    Feb 2, 2017
    Posts:
    40
    @SpookyCat Is there any way to cull or apply LODs to the wire? I have a long wire network and it's killing my performance. My poles have LODs and culling, but the wire exists everywhere.
     
  28. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    @BrokenVector - Sorry to miss your post, didnt get any notification of a new post here. As the wires are very simple meshes there is really no where for a lod to go to, I did have a LOD system in the asset a long time back, some of the code is still in the asset but it didn't improve the FPS at all and just added an overhead of extra memory for the meshes plus in most cases it slowed things down with having to have the option to update all the LOD meshes as well for the animating wires so it was removed. Lod systems work great for detailed meshes with lots of vertices and expensive shaders but for a mesh with so few vertices in there is very little to be gained, you are not reducing the actual pixel rendering amount at all on such thin meshes.

    You can also just put the wires on a Layer that gets culled at a certain distance from the camera using the Camera.layerCullDistance system in Unity. https://docs.unity3d.com/ScriptReference/Camera-layerCullDistances.html

    If you are getting a CPU hit from the physics to move the wires then you can have that be turned on and off by the system based on the wire distance from the camera and also there is an option to disable it if the wire goes of screen.
     
    Last edited: Oct 6, 2020
    BrokenVector likes this.
  29. BrokenVector

    BrokenVector

    Joined:
    Feb 2, 2017
    Posts:
    40
    Thanks SpookyCat. It's performing much better now and that saved me a lot of manual work. I'll my feedback accordingly.
     
  30. Tony-Lovell

    Tony-Lovell

    Joined:
    Jul 14, 2014
    Posts:
    127
    I have two main questions.

    One is a bug: I am using MegaWires to create halyards and rigging on a moving ship. When the ship moves, the wires move at TWICE the displacement of the ship's motion. This can be fixed if you take the dynamically-created Wires game object and re-parent it to the root. For instance, in the demo scene, this would be removing "Plant Poles Wires" from "Plant Poles" and "PolesList Wires" from "PolesList". It would be nice if the MegaWires script did this automatically.

    Second issue: With a play area equalling thousands of kilometers on a side, I need to be able to occasionally re-center my scene origin when the player strays too far from the origin and floating point precision problems present themselves. This entails occasionally moving every root scene object (even particles) by -playerObject.transform.position and having all physics and whatnot totally ignore the sudden movement, as it is merely a change in frame of reference. I have been unable to figure out how to do this to the Megawires.

    Third issue: is there a method I can call to freeze the wires in place? Some of my wires (e.g.: lifelines) are very taut and do not need constant modelling of their sway. They would still have to move with their ship, however.

    The second issue is essential for me. I hope you can help.

    tone
     
  31. SpookyCat

    SpookyCat

    Joined:
    Jan 25, 2010
    Posts:
    3,685
    Sorry didn't see there was a new post in this thread. There is a new version in the Asset Store that has a new component called MegaWireOrigin, if you add that to the root obect of the Wires then it will track any movement an update the wire physics.
    You can tell the system to not update based on distance from the camera, or you can just set the Disable All check box on the MegaWire object to lock the wires in their positions.