LogicalError / realtime-CSG-for-unity

Realtime-CSG, CSG level editor for Unity
https://realtimecsg.com
MIT License
732 stars 76 forks source link

UVs aren't updated when parent model is moved #360

Open SK83RJOSH opened 2 years ago

SK83RJOSH commented 2 years ago

I like to build my levels out of multiple models to keep the overall complexity down. This approach unfortunately has the drawback that when moving the base model, it's children don't have their UVs updated to match it's new world position.

https://user-images.githubusercontent.com/1371787/170689758-1161e06c-699e-4414-881d-2359494f9aa0.mp4

nukeandbeans commented 2 years ago

Define "base model". Do you mean the CSG model, a group, or ? Texture lock forces UVs to be locked to the brush, regardless of where you move it. If you want to keep the world position of the textures, then try it without texture lock enabled.

SK83RJOSH commented 2 years ago

Define "base model". Do you mean the CSG model, a group, or ? Texture lock forces UVs to be locked to the brush, regardless of where you move it. If you want to keep the world position of the textures, then try it without texture lock enabled.

So my hierarchy is more or less as follows:

CSG Model (Level)
    CSG Brush
    CSG Brush

CSG Model (House)
    CSG Brush
    CSG Brush

With or without the lock, the UVs aren't actually in world space, they seem to actually be in the models local space. So if I move the model itself around, it's children's UVs do not get updated. Which causes issues when building a level out of multiple models. Sorry for the lack of clarity there. 🙂

I'm not sure if this is intended or not, it very may well be, but that's somewhat problematic since it leads to you needing to manually offset the UVs if you end up moving a model around and want things to line up. It's an incredibly pedantic thing, but something that felt like a bug and worth mentioning. 😅