A Unity ID allows you to buy and/or subscribe to Unity products and services, shop in the Asset Store and participate
in the Unity community.
Discussion in 'Assets and Asset Store' started by ElroyUnity, Oct 17, 2015.
So wait maybe I didn't understand properly.
What is/was the issue?
The issue is if I don't set my player to Ignore Raycast layer instead of player then placement doesnt work right.
Let's try something, go to UCPhysics.cs and change line 74 to
if (UnityEngine.Physics.Raycast(origin, direction, out rayHit, distance, mask))
See if that works out?
Fantastic, that did it! Thank you for helping out, that was driving me nuts.
No problem will submit as a fix
Now that I got things rolling along a little bit more I came across another issue. When placing an item, if it's the last one left it doesn't get removed from the Inventory Pro equipment slot in the character window. At this point it is stuck until I reset things. If I have multiple building pieces it decrements fine, its just that last one.
Interesting, will get an inventory pro setup running this weekend and get you a fix
Awesome, that would be great. On another note, something for me to work on until that is resolved.
I got my foundation setup with all the sockets and its working out. However, my foundation has height to it. More it is a platform similar to your example foundation with legs. I'm trying to set it up so that the legs can go under the terrain and you can adjust the height as long as legs do no go above the terrain or the main platform does not go below the terrain, if so it turns red as not placeable.
Optimally it will be based on ray distance, if your at max distance and keep looking up the platform will raise. I tried messing with the offset at run time and changing the collider size trying to determine the best way to accomplish it. Is this something built in that I'm missing or will I need to code it in?
Uhmm you can just use the CheckForTerrain condition under each leg
That is only part of it which I got. I want the player to be able to raise/lower the foundation within the limits of the foundation height. Its up to them the starting point of the foundation height, could be flush with the terrain or up higher. You mentioned in the documentation "like Rust", that's exactly it.
You could make a key check for PageUp/PageDown or something like that and when pressed simply change the Y placingOffset of the structure
Gotcha, thanks for the clarification, I was just making sure it wasn't built in first. I think instead I will base it on the raycast hit distance. Closer it gets to you it will become flush with the terrain, further away it will raise.
Yep thats also something you can do
Will let you know about the inventory pro fix in the upcoming days
I never heard back about updating the free/demo version of uConstruct so today I pulled the trigger and bought the full version. Sadly, when I created a new, empty project and imported uConstruct into it I was met with pages of warnings and errors :-/
Cleared the errors and opened the CubesDemo scene. Couldn't seem to to do anything but spin the camera around, but then I noticed lots of errors showing up in the console; I hadn't created the layers uConstruct needs and it doesn't do that for you. Created the layers, re-ran the scene but still couldn't do much. The documentation says the key controls are shown in the UI, but they're not; everything shows either "0" or "1".
I figured out that hitting the 1 key turned on placement mode, but couldn't place anything -- the placement ghost was red and clicking anywhere had no effect. Finally figured out WSAD / arrow keys work to move around and managed to escape the maze of random objects I was trapped inside of, and was finally able to place a floor section. Figured out that some other number keys would sometimes enable placement of other types of object, to a limited degree.
Next I imported Inventory Pro and tried out the integration demo. It was almost completely non-functional, and again the console was full of errors. Since a lot of them were about missing script references I tried re-importing uConstruct (on the theory that the script references that were missing may have been due to not having Inventory Pro in the project. Unfortunately, that didn't fix anything.
[EDIT]: I also tried building and running the CubesDemo scene on an iPad. The first line of the asset description is "*MOBILE READY*", which is the main reason I've been gravitating towards this solution. I had low hopes by this point so I wasn't surprised that it wasn't usable. I haven't dug in to see if the demo scene actually contains anything mobile / touch-input related, but even if the product is 'mobile ready' the demo certainly isn't.
All in all everything feels clunky, unpolished and broken. I should have waited for the free/demo version and saved myself the $30 :-/
DId you follow the documentation? Did you create the layers?
Please mail me or add me on skype - elroi145.
I will go through the issues with you until everything is fixed and working as you would expect it to
Hi, I just bought uConstruct and I can already get it running. I now need to add the building when I use the item,and press right mouse to cancel build,what api I should use in my item use script?
I use this since it was in beta for mobile ( Just sold the game to an investor. ) it worked flawlessly. I made some of my own changes, due to the nature of my game. and what I was using it for. but as far as mobile. not sure what was clunky sorry I dislike that word as it don't explain the issue. I'm sure Elroy will help you get it going if there is an issue. but I never ran into anything game breaking.. I also do not use unstable versions of Unity or beta versions, so I can't comment. 2017.4 is Unity most current stable version. 2018 is getting there, so it should work fine. but can't say with out errors as I know Unity 2018, has a ton of GUI issues and editor related issues, that they been fixing. Anyways i'm sure Elroy will help you. regardless. good luck with your game. on Mobile.
Uhmm what do you mean? Are u using an inventory system?
I used my own inventory, now no problem, I found the way, just call the properties and methods in the placer script.
Thanks for reply.
Happy you worked it out
Nice Find! Now the sea don't interrupt placing foundations
Hey, any chance this may get integrated for UFPS2?
Hey, not any time soon sorry
Has anyone got this to work with VR? Or VRTK? How can I integrate it? IANAP
Shouldn't be a problem
What are the issues you are facing?
Is there a tutorial for setting it up with VR? I am not a programmer
I would like to map placement buttons to the touch controllers
No, I will try to make a demo for you but I don't have time week.
If you do end up trying and need help feel free to ask, but I will try to get you that demo anyways
I'll wait on the demo! Thank you so much I really appreciate that
About VR, I was abIe to make uConstruct work with Vive pretty nicely, except I cannot find a way to draw all the buildings prototype lines (e.g. sockets in VR). Could you please help what should make the trick? If I set Camera.TargetEye to None, it displays everything OK in preview window, but as soon as I choose anything else it just skips drawing those lines.
Uhmmm that’s a good question, you are talking about Gizmos or the preview material when placing the building?
Yes, about gizmos (I think, more like guiding lines for me), it seems Graphics.DrawMesh (if I remember correctly looking at your code, not a t home now) doesn't work in VR. I I changed your code a bit to always show a building part when moving it, so it is easier to set up, but visual guidance where to put that part would be more convenient anyway.
And a big thank you for your continuous support, I bought it several years ago but haven't chance to really try it, and it is so easy to work with.
First of all, absolutely, happy to help
Regarding the issue - uhmmm do you want to send me a picture of what you mean? still can't really understand what you are talking about, sorry!
I sent PM with pictures to you, thank you for looking into this!
Hey, In the Photon Cloud demo integration if i spam left click i'm able to place multiple foundations in the same location, and after that the whole system kinda breaks because i'm now able to keep placing multiple things all on top of eachother:
Edit: I was able to kinda fix this by expanding the box collider size to 5.99/6 units for the CheckForCollisionCondition, now it behaves like this:
that makes these lag spikes appear though:
Also, i can't uncheck this checkbox, it keeps rechecking itself every time i press Play in the scene:
Pretty good asset otherwise!
1. Interesting, will have a look in the next few days (in the army now so I am not near the office)
2. Oh makes sense, go to the "PhotonCloudBuildingPlacer.cs" file and remove line 20 (PhotonCloudBuildingPlacer)
Also, I'm having problems with a rotated building part.
I want to be able to free place props on it, so i made a freeplace socket (The one that has 'Default draw socket' enabled)
But the free socket somehow seems to get expanded into a cube of some sorts and I'm able to place the object all around it
If i rotate the same part to 0,0,0 it seems to work properly
Edit: Fixed it by disabling uConstructPhysics on that socket and replacing with a standard box trigger so unity physx can take over the raycast
Awesome happy you fixed it!
Another problem, if i change the building's health in the Photon Cloud Integration from 100 to even 99, it just destroys itself immediately
Really? I haven't actually encountered that before.
Can you show me the code where you change it?
Hmm, the problem seems to be with my modification to the BaseBuilding editor class to just expose Health as an editable parameter
script.health = EditorGUILayout.IntField(new GUIContent("Health", ""), script.health); , probably tripping off some getters/setters or something
When i use the editor debug mode and change health there, it doesnt call the setter, also not calling OnHealthChangedEvent, so the wall doesnt get destroyed, but if i change it through the editor variable that i just exposed, it does trigger a setter and does call the function.
Also, if you dont mind me asking, why not use the Photon's RPC's instead of custom messages?
Uhmm that's strange, you should only change the max health, not health.
And I use custom messages to fully control the way it transmits the buildings especially for new connections
What do you mean?
It seems that this method gets called twice when i change the health variable, first time with proper health value, second time health value is always 0 and that destroys the object
Yep, but instead, change the building.MaxHealth, not the health variable.
So is BaseBuilding.health an internal thing? If i wanted to made like a breaking and repairing buildings mechanic, would i use building.health, building.maxHealth, or make my own variable?
You would simply do -
building.Health -= value;
To assign initial building value - building.maxHealth = value
Yes, doing that immediatly destroys the building for me in the Photon Cloud integration
Uhmm I see, will have a look today and let you know