Closed ghost closed 6 years ago
I can imagine, the default Unity primitives are a nightmare. Luckily part of what you desire is already possible. Select any brush that you wish to turn into collision and simply turn the visibility off:
It will have CSG with other collision-only brushes but not with your world. NoCSG collision-only currently doesn't work that's why I opened issue #106. But it works fine if you just leave that off.
As for layers and triggers, that may get a bit more complicated. I tend to just create another CSGModel on another layer for these types of things. Some settings may keep getting reset every time you build the world though. Let me know if you have any suggestions on improving it.
There's also a bug... if you have a CSGModel with only collision brushes for some reason 1 collision brush won't actually get any collision. But you can duplicate it and then it will work. Not sure what's causing that. But just saying in case it doesn't work for you, this may be why.
Thanks for responding!
Triggers in the shape of brushes would be incredible to have and it's definitely something we should look into. Right now you'd have to create a CSG Model for every trigger, rebuild it and then attach game logic to the CollisionMesh or MeshGroup, it's not a nice solution/workflow. Especially when you need a lot of triggers. Right now I can't think of anything that's generic enough to fit all use-cases people may have for triggers.
Maybe having it as a brush? then putting the script / logic on that brush instead of on the model?
The first thing that comes to mind with this is how UT04 and UE3/4 handles volumes. This could, for example, be a compound brush that only creates a volume the size of its bounding box. Or a 3rd brush type that contributes to its own sub-hierarchy under MeshGroup. It would not need to generate meshes, except in the case of custom trigger/volume shapes. Otherwise it would simply create a gameobject with the correct scripts/components added.
Something like this:
As far as actually firing events, you could simply use the built-in unity events system. It even has a UI in the inspector (if you look at the UI elements where they have events they can fire). This could allow the user to simply assign what they want to call in their scripts, and be decoupled from them, as well.
I did want to look into this, as its something I very much have use for.
So over the past few days I've sorta getting annoyed with using just the normal primitive models and just making them a trigger or clipping, But it doesn't work well with snapping and resizing and inst really neat. So I thought maybe there could be a Trigger brush type and also maybe a Collision / Clipping brush type. Both of these would fall under the Additive and Subtraction, except as they state one will be only for collision and the other for triggering. Both would be NoCSG and also maybe with the collision brush type, you can select which layer gets affected by it?