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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

[RELEASED] uConstruct - Fully generic, socket based runtime construction system

Discussion in 'Assets and Asset Store' started by ElroyUnity, Oct 17, 2015.

  1. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Oh thats a neat feature, will add !
     
  2. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Finally got round to implementing authoritative building placing and I'm glad to say that uConstruct delivers! Perfectly. :) The UNET example code really helped us save time. Thanks for creating this package (again) ;)
     
    ElroyUnity likes this.
  3. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Happy to hear :D
    Its my pleasure!!
     
    Stormy102 likes this.
  4. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Hey having trouble adding UFPSBuildingPlacer to the UFPS HeroHDWeapons UFPS prefab. "Can't add script component 'UFPSBuildingPlacer' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match. There are no compile errors in my console.
     
    ElroyUnity likes this.
  5. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Did you enable the extension ?
     
  6. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Yeah, UFPS is "active".
     
    ElroyUnity likes this.
  7. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    No no I mean in the extensions window of uConstruct
     
  8. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Do you mean the "Activated" tickbox in the uConstruct tickbox? Because that's what I mean by active. It's ticked for Activated.

    Happy holidays, btw. Thanks for replying!

    Edit: tried in a new project with only UFPS and uConstruct and I get the same issue.
     
    Last edited: Dec 25, 2016
    ElroyUnity likes this.
  9. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Weird... haven't heard that before, will test it later today when i am home
     
    snowcult likes this.
  10. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Thanks Elroy.
     
    ElroyUnity likes this.
  11. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    My pleasure !
     
  12. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Hey. Sorry if this is explained already, I'm just going through experimenting with my own foundation model. I have something similar to rust, a foundation that extends under ground with the idea that the height can be changed by moving the mouse, with a cap at how high it can be placed (Rust video to demonstrate what I mean: https://streamable.com/jrrb2). Is this possible? Again, sorry if it's explained already, as well as the second part of the video where there is a minimum distance you can place between two unlinked foundations. I'm still reading through the docs and watching the videos :)


    Edit: Upon further reading, it looks like Freely Based could possibly be what I'm looking for! Sorry for the bother.

    Edit: Maybe not lol
     
    Last edited: Dec 27, 2016
    ElroyUnity likes this.
  13. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm should be possible but might require a bit of coding, not a lot though, what I can think of at the moment is changing the building placer script to be based on distance from the player instead of raycast and from the mouse movement lift it and so on. Now, I suppose you dont want it for all of the objects so you can inherite from the BuildingPlacer and then do a check if the building is a foundation, if it is, use the method above and if not then use "base.Update()" to use the original placing method.


    Now, about the UFPS issue, I looked into it and it seems like it works great, I know i asked already but does it look like that:
     
    snowcult likes this.
  14. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Cheers.

    As for the UFPS issue. Yes it does. At a loss here, no warnings relating to this at all from either UFPS or uCon. Same error, no matter what.
     
    ElroyUnity likes this.
  15. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm what unity version are u using ? and latest UFPS version ?
     
  16. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Hey, latest UFPS and Unity 5.5.0f3
     
    ElroyUnity likes this.
  17. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Okay, will check again today :)
     
    snowcult likes this.
  18. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Thanks for your help. Btw, I'm using the regular Building Placer script just fine. Just figuring out integration with UFPS and Ultimate Inventory now.
     
    ElroyUnity likes this.
  19. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,996
    How is serialization/deser handled? Code example?
     
    ElroyUnity likes this.
  20. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Normal binaryformatter, but i am changing to protobuffs to add support for Windows Phone.
    Do you still need code example ? :)
     
  21. laurentlavigne

    laurentlavigne

    Joined:
    Aug 16, 2012
    Posts:
    5,996
    Yes please, of the protobuffs
     
  22. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Will send you a code example once its done :)
    Should be able to release this as a big update somewhere next year, just finished uNature so I got a lot more free time :)
     
    laurentlavigne likes this.
  23. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Okay, still figuring things out. I've been messing with settings for hours, but I don't seem to be able to figure this one out.

    https://streamable.com/czgr9

    The flashing between red and green is significantly faster than this, btw, it's just recorded at a fixed framerate. It flashes between the two positions at least 120 times a second, making it quite hard.
     
    ElroyUnity likes this.
  24. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    uhmmmm can you show me the conditions that you are using for that block?
     
  25. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Just a collision check and a ground clear (though the ground clear is unnecessary at this point). This happens without the collision check, too.
     
  26. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm okay I see, if possible, send me your prefab + model privately (or just replace it with a simple cube, doesnt matter)
    I will try to reproduce it and fix it :)
     
    snowcult likes this.
  27. jrock84

    jrock84

    Joined:
    Jan 13, 2016
    Posts:
    38
    First of all, very nice asset! Absolutely love it! It just works and has a lot of well thought out features.

    I have a slight issue, though, if you can help. Just doing some initial testing and using the default assets, I'm experiencing jittery placement when placing the first foundation. It just looks kind of bad. Any resolution for this? It does this in the demo scene for me as well. Thanks for your time!

     
    ElroyUnity likes this.
  28. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm I havent ever seen that behaviour before, what unity version are you using ?
    Also if you import uConstruct into a fresh new project and run the demo scene does it happen as well (I read that it does in your project, so maybe it's an issue with one of the assets in your project)
     
  29. jrock84

    jrock84

    Joined:
    Jan 13, 2016
    Posts:
    38
    I'm currently using 5.5.0f3. I'll try importing into an empty project later and see what the results are.
     
    ElroyUnity likes this.
  30. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Cheers :)
    Lmk how it goes!
     
  31. jrock84

    jrock84

    Joined:
    Jan 13, 2016
    Posts:
    38
    It doesn't do it in the empty project with just UFPS and uConstruct, but I just tried it with the player you have setup in the demo scene for UFPS. Any ideas? I'll see if I can track down. Also, you may want to re-upload your package to the asset store. Every time I import this package, I have to make a change in some of the scripts and save them before they will be recognized in Unity as valid script files. I have deleted the cached package file and re-downloaded.

    *EDIT
    Ok, I was able to reproduce by using the HeroHDWeapons player prefab from UFPS and adding the uConstruct components onto it.

    *EDIT2
    Found it! It's the vp_ragdoll handler and vp_fpbodyanimator on the body portion of that player prefab. Can you take a look at this?
     
    Last edited: Jan 7, 2017
    ElroyUnity likes this.
  32. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yes I'l take a look but if its an issue from UFPS it self there wont be much I could do as it might be adding walk animation to the building or smth, I can't tell.

    I will check it out hopefully tomorrow and lyk :)
     
    snowcult likes this.
  33. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Btw, Elroy, managed to fix the issue of not being able to add the UFPSBuildingPlacer to my controller.

    Was as simple as changing this:

    using UnityEngine;
    using System.Collections;

    to this:

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    Whether that specifically helped or not, I'm not sure. It could have also just been the fact that I deleted the original script and created a new one. Maybe it wasn't importing properly.
     
    ElroyUnity likes this.
  34. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Yep, copied uConstructEquipment into a new script unmodified and it's usable now. Weird problem! Awesome :)
     
    ElroyUnity likes this.
  35. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    To expand on this, it seems as though once it gets locked into the reach distance, it doesn't shake. https://streamable.com/5lrtw


    Edit: Another problem I keep having, because I have a foundation that is quite tall for my foundation (in regards to the demo foundation), if I try to offset by -1 so that it's closer to the ground, with more of the model under ground, then any foundation attaching to that after will be offset by -1 as well, creating a stair effect. (this image is from under the terrain)

     
    Last edited: Jan 8, 2017
    ElroyUnity likes this.
  36. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    Check if the object is snapped, then set it to 0
    Code (CSharp):
    1. if (currentBuilding.SnappedTo)
    2. {
    3.     currentBuilding.placingOffset = new Vector3(0, 0, 0);
    4. }
    5. else
    6. {
    7.     currentBuilding.placingOffset = new Vector3(0, -1, 0);
    8. }
     
    ElroyUnity likes this.
  37. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    That's awesome!

    And yes, try doing what Stormy did in the building placer for the offset, will fix it in the new version.

    Lmk if you need a fix asap
     
  38. jrock84

    jrock84

    Joined:
    Jan 13, 2016
    Posts:
    38
    I had two scripts that did that as well. I just put a space somewhere in the scripts and saved them back. They imported correctly after that.
     
    ElroyUnity likes this.
  39. Stormy102

    Stormy102

    Joined:
    Jan 17, 2014
    Posts:
    495
    No need to. Just select it then go to Assets -> Reimport Asset
     
    ElroyUnity likes this.
  40. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    172
    Hi,

    I just boght this asset and before diving in just want to check if there is any support for UNET (Unity networking) ? (i saw that the asset work with bolt...)

    Thank you
     
    ElroyUnity likes this.
  41. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yes :)
     
  42. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    172
    Great !!

    Ok so i spent 3h discovring the asset !! and it look really nice !

    Now i'm running into this problem :

    How to make UCPhysics.Raycast ignore the Player Layer (i'm in a moba camera style). so i want the user to be able to place an object on the player object position ?

    I've tryied to add the player layer to the layers to be ignored (in LayerMask myLayerMask) UCPhysics.Raycast, but it's not workig. The function (UCPhysics.Raycast) stop to hit the Terrain once the mouse is on the player !?

    ps: i'm not using any condition, just a simple object with 2 sockets in each side (wood fence)

    Code (CSharp):
    1.  
    2. public LayerMask myLayerMask;
    3.  
    4.   void Update () {
    5.  
    6.             UCPhysicsHit Hit;
    7.  
    8.             if (UCPhysics.Raycast(ray, out Hit, 50f, ~myLayerMask)) {
    9.  
    10.                 Debug.Log("We have hit=>" + Hit.transform.name);
    11.                 UCPhysicsHitsArray Hits = new UCPhysicsHitsArray();
    12.                 Hits.AddToList(Hit);
    13.  
    14.                 bool isFit = currentBuilding.HandlePlacing(Hits);
    15.                 Debug.Log("IS FIT ==>" + isFit);
    16.             }
    17.  
    18. }
    Any help will be much appreciated.

    thanks
     
    ElroyUnity likes this.
  43. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Uhm strange...
    I will look into it, but if you want an easy fix for now, go to your one of your player scripts and add - uConstruct.Core.Physics.IUTCPhysicsIgnored interface and it should ignore that object.

    Actually you can even add it to the building placer instead but once that's on one of your player scripts it will be ignored automatically :)
     
  44. whatbus2000

    whatbus2000

    Joined:
    Nov 21, 2014
    Posts:
    65
    hello. Great asset.
    Can we have a more in depth tutorial on snap points.
    My situation is I want to make triangle as well as square foundations (like rust) but am having trouble.
    Do I just use one snap point? or do I have one on each socket? Does the rotation of the snap point affect the building being placed. Please help. I am novice
     
    ElroyUnity likes this.
  45. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Yes you need to have a snap point on both and then it will attach it self. So for instance if you have building X and building Y

    Both X and Y need to have a snap point on each connection point.

    I will make a tutorial about that soon :)
     
    Sarrivin likes this.
  46. amynox

    amynox

    Joined:
    Oct 23, 2016
    Posts:
    172
    I put the interface in my player script (with Ignore => return true) but sadly it's not working.

    I tweaked the RaycastAll function to make it work like i want waiting for your fix ;)

    if that can help someone :

    Code (CSharp):
    1. public static UCPhysicsHitsArray RaycastAll(Vector3 origin, Vector3 direction, float distance, int mask, float offset, int maskToIgnore = -1)
    2.         {
    3.             UCPhysicsHit hit;
    4.             hits = new UCPhysicsHitsArray();
    5.             ray = new Ray(origin, direction);
    6.  
    7.             for (int i = 0; i < physicsObjects.Count; i++)
    8.             {
    9.                 currentPObject = physicsObjects[i];
    10.                 if (Vector3.Distance(origin, currentPObject.transform.position) <= distance)
    11.                 {
    12.                     if (currentPObject.Raycast(ray, out hit, mask))
    13.                     {
    14.                         if (hit.distance <= distance && hit.distance >= offset)
    15.                         {
    16.                             hits.AddToList(hit);
    17.                         }
    18.                     }
    19.                 }
    20.             }
    21.  
    22.             //Added by Amynox
    23.             if (maskToIgnore > 0)
    24.                 maskToIgnore = ~maskToIgnore;
    25.  
    26.  
    27.  
    28.            //Added by Amynox : maskToIgnore
    29.             if (UnityEngine.Physics.Raycast(origin, direction, out rayHit, distance, maskToIgnore))
    30.             {
    31.                 if (rayHit.transform.GetComponent<UCPhysicsObject>() != null)
    32.                 {
    33.                     hit = new UCPhysicsHit();
    34.                     hit.Convert(rayHit);
    35.  
    36.                     hits.AddToList(hit);
    37.                 }
    38.             }
    39.  
    40.             return hits;
    41.         }
     
    ElroyUnity likes this.
  47. stickybz

    stickybz

    Joined:
    Oct 12, 2016
    Posts:
    8
    Hey Elroy
    Any chance of updated video tutorials? Am having real issues following. You said to make a new building part to add building script and copy conditions from your prefabs, but in the videos it looks a lot quicker using blueprints. Tried to use the forge blueprints , the prefab seems to be created with sockets conditions but is invisible? I can't even get the multi select thingymagig to work , "press left control" didn't work. Would love a real slow simple tutorial for simpletons like me
     
    MaskedGibbon, Sarrivin and ElroyUnity like this.
  48. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588
    Hey!

    Yes, currently finishing up v2.0.5 of uNature and then going to spam out tutorials for both assets (uNature and uConstruct) including subtitles for each incase some parts are not-understandable :)
     
  49. Sarrivin

    Sarrivin

    Joined:
    Dec 18, 2015
    Posts:
    24
    Hi Elroy!

    This is a great asset. Having played around with it only for a few hours I'm guessing you have the best proposition, but competition isn't sleeping.
    If you could combine features of those systems with your implementation, to make it a bit easier with UI and look a bit more polished, you'd probably have undeniably the best system:
    https://www.assetstore.unity3d.com/en/#!/content/45394
    https://www.assetstore.unity3d.com/en/#!/content/75709
    Especially layers are useful. I will most likely use your system in all modes, but top-down view is my priority so yes, if you could add layers it would be really great.
    I think eventually the best runtime building system in Unity Store will need to combine ease of use with a bit better looking starting objects. It's marketting ;). But that list of objects, like in that one with layers is what people seek. Of course, feature-wise, especially in compatibility, physics and UNET/other networking, you rule.

    Just not sure about performance with really well textured objects and AA+ lightning/shadows in an environment like Gaia?
    I imagined that maybe I could let players create their levels, then those would be saved to disk. Then I would bake the lightning for their levels and then the game could work much faster, with baked lightning. Because the problem with runtime building is that it's all realtime, so either no shadows/lightning, or we'll most likely run into performance issues ;(.

    Overall, if you could implement such features it would be really awesome:
    1. Better support for top-down view - especially layers.
    2. A UI list with a 3D image of object to choose and that currently selected. I think you'd be surprised how big difference that would make for your income, as people are looking for such asset all the time.
    3. More options for showing objects for placement visually. Not only via choosing color, but maybe also outline, some touches like that. I guess it's usually done by shaders.
    4. Make an option for objects adjust to the shape of the ground. So you could put an object on a slope, for example, and it would automatically rotate. Such options would use some setting to tweak, like maybe those of Gena (check that thing in asset store, but Adam Goodrich). So we could make an object, like building, "sink" into terrain when the slope isn't more than 30 degrees, and if it's more than 30 degrees, automatically rotate object to terrain.
    5. There should be easy option to rotate objects, just by pressing some key, mouse or UI button. Rotation should be by either set number of degress or free rotion by clicking to place and object and rotating by moving mouse cursor up/down.
    6. We should be able to click on object and move it around, rotate it, copy, duplicate, etc.
    7. Workflow for adding new objects and their sockets, etc. could be simplified, but it's quite ok for me. Just saying much more people would buy if it was easier.
    8. Terrain/object removal around your placed object would be great. Like automatic removal of rocks, grass, trees, etc. around placed object.
    9. Option to disallow placing object near some other object (some distance, collider, etc.).
    Good thing about implementation of such features would be that once you do it, it's done and we all benefit :). I'm sure some day someone will do it, as we must write such modifications for our games either way. But I'd be really happy if that was uConstruct.

    ps. looks like maybe it's done using uConstruct? Great example of what I'd like to be able to create. I guess it's entirely possible.
     
    Last edited: Jan 28, 2017
    ElroyUnity likes this.
  50. ElroyUnity

    ElroyUnity

    Joined:
    May 20, 2015
    Posts:
    1,588

    Hey!

    Thank you very much for your feedback, so lets begin, uConstruct infact does have layers support and also batching so all buildings are combined into one mesh which is very very essential for good performance.

    1) Didn't get any bad reports about that one so I would assume it's already working, did you find any bugs with it?
    2) Good idea, going to add it to the milestones for the new version (Will post a trello soon just like I did for uNature)
    3) Yea, the issue with that is that you will have to change the shader of your building in order to do that, but I might be able to get a workaround for that, again, will also add that to the roadmap :)
    4) Already possible, but without the slope limit, will add.
    5) Yep indeed, already available :D
    6) An edit feature is something interesting - I will add it into the roadmap and add that feature.
    7) Yep, I plan to do a huge rewrite to the sockets system soon to make it so much more easier to use, but don't have an estimate as of now :)
    8) Already available as part of the terrain modification condition :)
    9) Yep, you can use the CheckForCollision condition for that :).


    Thank you very much for your feedback and ideas! super appreciated!
     
    recon0303 and Sarrivin like this.