Jump to content

Koyemsi

Members
  • Content count

    9
  • Joined

  • Last visited

  1. Koyemsi

    How to script extrusions

    You guessed right @karl, the problem came from static batching. I made my cubes not static anymore, and now everything works fine. It also solves a lighting issue, which makes my procedural frames appear less white than they should. I always forget that the default state is static when creating a PB object. Thank you so much ! By the way, 2 questions : 1- To make them not static, I just unmarked the checkbox at the top of the inspector. Is it OK to do so, or is it better to change the Entity Type to Mover ? 2- About assigning different materials to faces. Before PB became part of Unity Technologies, dragging materials directly from the assets to the object's face had bad results, and the Material Editor was the only way (but not so handy). Now it seems to work, is that right ?
  2. Koyemsi

    How to script extrusions

    Forgot to put my script, which is quite simple : using System.Collections; using System.Collections.Generic; using UnityEngine; using ProBuilder2.Common; using ProBuilder2.MeshOperations; public class Encadrement : MonoBehaviour { public float largeur = 0.2f; public float epaisseur = 0.02f; public float profondeur = 0.1f; void Start () { pb_Object pb = GetComponent<pb_Object> (); // 1 - backface extrusion pb.Extrude (new pb_Face[] { pb.faces [0] }, 0.025f); pb.ToMesh (); pb.Refresh (); // 2 - borders extrusion pb.Extrude (new pb_Face[] { pb.faces [6], pb.faces [7], pb.faces [8], pb.faces [9] }, largeur); pb.ToMesh (); pb.Refresh (); // 3 - borders 2nd extrusion pb.Extrude (new pb_Face[] { pb.faces [6], pb.faces [7], pb.faces [8], pb.faces [9] }, epaisseur); pb.ToMesh (); pb.Refresh (); // 4 - sides extrusion towards front pb.Extrude (new pb_Face[] { pb.faces [18], pb.faces [20], pb.faces [22], pb.faces [24] }, profondeur - 0.025f); pb.ToMesh (); pb.Refresh (); } }
  3. Koyemsi

    How to script extrusions

    Hi, I did some progress with my framing script. It now works, but I have new issues. Here is how I proceed. First I create a PB cube, with 3 different materials (left picture). Then, I attach my script (Encadrement.cs) to it. It generates the frame, by extruding several times the back face (see the result on the right). Everything's fine until I put a second painting in my scene (the same way, with a new PB cube). See case 1 below. It seems that their meshes are combined in a way, as I obtain this error : This is quite strange, as I have in my scene another PB object which doesn't cause trouble : it is one first painting for which I've created the frame manually (so this object doesn't make use of my script). Moreover, this issue occurs even if I deactivate my script on one of my 2 paintings. The only way I can have it work again is to deactivate the entire game object (case 2). But, if I reactivate it during runtime, then it works (case 3) ! Both of them get procedurally framed if not activated at the same time. Last thing I have to mention : Polybrush and Progrids are also intalled in my project. The odd thing is : whatever the last tool selected (scale tool, rotation tool...), when I run the play mode, a Polybrush tool is automatically activated. Is it a bug with the beta version of Polybrush ? And could this have anything to do with the first issue I mentioned ? Thanx in advance for your help.
  4. Koyemsi

    Conform object to face normal

    I assume you're talking about painting with prefabs, like for Terrains ? I tried this, and it worked in a certain way : I had to reset my clone's rotation on 2 axis, as its up vector was matching the wall's normal, and its y rotation was randomly chosen. But the third rotation value seemed to match perfectly the wall's orientation. But there's another problem with this technique : the clone generated is no more linked to the original prefab. So I deleted it, and placed a new prefab with the same rotation values. Not the easiest way to proceed, but it seems to work accurately enough.
  5. Koyemsi

    Conform object to face normal

    Thanx for your replies, dear admins. ProGrids sure enters my top 5 "by default installed assets" as did ProBuilder. And PolyBrush will also certainly, when in a stable version. Being able to work with vertices and edges using "real local grids" would be a great enhancement. I will script something as Karl suggested, but I thought such a feature might be existing in Unity or in PB/PG. I was hoping even for a weird combination such as Alt+Shift+Command+TripleLeftClic to do a "conform & snap". Well, maybe in a future version... Thanks again guys.
  6. Koyemsi

    How to script extrusions

    Thank you very much, I will look for them and I'm sure it will help.
  7. Koyemsi

    Conform object to face normal

    Thanks a lot for your quick reply. I've been using PB for about a year, and I have to say I really love this asset. I've also installed ProGrids and PolyBrush yesterday, and just began using them ; they're great too, but I'm not totally accustomed with them. I didn't know one could draw with Polyshape along a surface, neither did I for the locally oriented grid . These are neat features ! But what about just placing (not drawing) a ready-made prefab ? Sorry if my question seems noobish
  8. Hi. I've designed an interior with PB. Some of my rooms have oblique walls. I have several prefabs (paintings, posters, luminaries...) which I want to hang on these walls. Is there any way when editing to ensure that they conform (and snap) to the surfaces ? In other words, to make sure the adopt the same orientation as the oblique walls, without having to search for the right rotation amount ? Thanx in advance.
  9. Hi everyone. I'm doing a virtual art gallery for a painter friend of mine. I do all the design with ProBuilder which is great. Having a lot of paintings to exhibit, and none of them being the same dimensions, I'm trying to write a script to create dynamical framing. For each painting, I'm using a PB cube set to the painting's dimensions. Then I attach my framing script to it, so that the frame is created at runtime, using several extrusions. Unfortunately my script doesn't work very well. Is there any scripting documentation available ? Thanx in advance.
×