Quantcast
Channel: Questions in topic: "segment"
Viewing all articles
Browse latest Browse all 14

Segmenting a Box (Primitive Cube) Procedurally

$
0
0
Hello all! I am looking for answers on the best way to build (procedurally from code) a user-defined 'box' in Unity. Specifically, I want the user to be able to define length, width, and height and then for the code to procedurally generate the box uniformly segmented through x, y, and z according to the defined size of the grid at that instance (for simplicity, let's define this now as 1.0f, or 1 meter in Unity). Even more specifically, it is worth pointing out that this should not generate a 'lattice' through the whole volume of the box, only generate the surface points on the 'hull' of the box. An example would be: I define a box 2 in length (z), 3 in width (x), and 4 in height (y) - according to the Unity axes. The grid size is 1.0f. The 'hull' of the box will be generated with procedural segmentation: 2 segments in length, 3 segments in width, 4 segments in height. The surface area of the box will be constructed of 52 1.0f x 1.0f square 'patches'. I have tried now for a few weeks, being quite new to c# code. I have read many articles, followed many examples, and I am very happy procedurally generating a cube in Unity but this tessellation is proving a problem. For anyone kind enough to offer an answer: - Please **do NOT** refer me to existing scripts in the asset store; I am doing this for a very specific purpose and not understanding how this works in Unity & c# code will not help me at all. - Please provide examples in c# if you can as my Java syntax is a little choppy. Many thanks!

Viewing all articles
Browse latest Browse all 14

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>