AndyFenwick / FenceLayout

Fence Layout tool for Unity
http://www.polygonpi.com
MIT License
23 stars 3 forks source link

Terrain placement issue #2

Closed slackersink closed 4 years ago

slackersink commented 4 years ago

I have an issue with the placement of the fence. I'm using the path here as where the fence should lay, but as you can see if this image posts properly, it starts under the terrain and moves in a straight line.

image

I am using the latest Gaia Pro version. From tests, this seems to possibly be the issue. I create a world, add standard unity terrain in, and the fence system works properly. When I delete that, then create a Gaia stamped world right after, that's when the issue starts.

This is with your march 10th fix, as well. I am using Unity 2019.3.12 Gaia Pro 2.1.4

AndyFenwick commented 4 years ago

My first thought is that it may be finding the wrong Terrain component? Is there still one left over from the original terrain? Maybe try making it a variable and setting it explicitly?

I’ve not tested in 2019.3 and the latest Gaia. The last Gaia was broken in 2019.3 so they may have changed something. I’ll try at some point.

slackersink commented 4 years ago

Thank you for the quick reply! The screenshot was in a world created only in Gaia. I made a new project to test with and without Gaia, and had the same results only when I created a new Gaia terrain..

Since Gaia can quickly set up multiple terrains, this map has 4. I just did a test with all 4, and it looks like one terrain, set at 0 on the x and z axis, does control the fence, and the second it leaves that terrain and onto one of the other 3, it loses control.

image

"Maybe try making it a variable and setting it explicitly?" I'm sorry, I'm the art guy of our group. haha Can you explain that? Or at least enough to where I can give it to the guy doing the coding to see. :)

Gaia earlier this year was pretty iffy, yeah. Recently, they put out a proper Gaia Pro and Gaia 2 that changed quite a bit from that beta they put out that's fully compatible with 2019.3. As the artsy guy, I'm way happier with Gaia now. haha

AndyFenwick commented 4 years ago

OK I know what the issue is, it’s because the tool isn’t set up to work with multiple terrains so it always uses the first one. Hopefully should be easy enough for your tech guy to fix though (I can’t fix it right at the moment, no time due to family).

FenceLayoutEditor.cs m_mainTerrain = FindObjectOfType();

Probably the best solution is to find all the terrains instead, and when sampling height, use the one that the coordinate is contained within (all sampling goes through one function as of last commit).

Hopefully I’ll get some time in the next week to fix it myself, but no promises. I’m still in the Gaia Pro beta from a few months back, I should get back to it and update and take a look!

slackersink commented 4 years ago

Thank you. :) I'll send the info to him.

And also, just... whoa. image

It works perfectly on the first terrain and really helps even an empty world look nice. Thanks for creating this!

AndyFenwick commented 4 years ago

Hi. I found a few minutes and repro'd your bug, and I've committed a fix to FenceLayoutEditor.cs. It finds all terrains in the scene instead of just the first one, and when sampling terrain height it checks each terrain to see if the position is within the XZ bounding box. I dragged a fence over all four terrains and it updated properly. Let me know if you're still seeing issues.

Thanks for the feedback, I'm glad you're finding the tool useful, and good luck with your project!

slackersink commented 4 years ago

Thank you for the quick response and fix! It works perfectly. :)

I had an issue when updating, which was totally 100% my fault. I had the old gameobject created still up, and forgot to update the script for it, so I was getting an error. NullReferenceException: Object reference not set to an instance of an object FenceLayoutEditor.ApplyEdit () (at Assets/PolygonPi/FenceLayout/Editor/FenceLayoutEditor.cs:249)

Since I was still just playing around, I deleted both the asset and the gameobject and restarted the world, and everything works great now, even when going from one terrain to another. Just in case you see anyone ask about that error in the future when upgrading. :p

AndyFenwick commented 4 years ago

Cool, good to hear. Cheers for the heads up on the error - to be honest I'm not surprised about random errors when modifying editor code while the editor is running! I suspect a scene change or an editor restart would also fix it, without having to delete anything. All working, I'll close the issue. Thanks!