Extended Primitives

Overview

Extended Primitives is an pack of parametric WYSIWYG 3d objects for prototyping, visual design and data visualization. All object has non-overlapped adjustable UV coordinates, parametric fillet edge, full control over detalization. Pack includes 3d objects:

Charts:

Numerical Grids (based on Line Renderer):

Features

Latest Versions

Installation

Compatibility

Create primitives

create primitive

add component

using UnityEngine; using ExtendedPrimitives_11; public class EpTutorial : MonoBehaviour { void Start () { FilletBox fb = FilletBox.Create(); } }

Modify size

to modify size use inspector

add component

add component

using UnityEngine; using ExtendedPrimitives_11; public class EpTutorial : MonoBehaviour { void Start () { FilletBox fb = FilletBox.Create(); fb.Size.Height = 10; fb.Size.Width = 7; fb.Size.Length = 5; } }

Modify topology

Topology foldout describes Primitive`s detalization and partial surface hidding. Changing the topology leads to memory allocation, so avoid frequently change the topology in Play Mode.

To modify topology

using UnityEngine; using ExtendedPrimitives_11; public class EpTutorial : MonoBehaviour { void Start () { FilletBox fb = FilletBox.Create(); fb.Topology.Bottom = false; fb.Topology.FilletSegments = 4; } }

Modify Texure (UV) coordinates

Each primitive can generate uv coordinates based on its own size

uv inspector

There are two UV channels that can be used, and 3 different types of UV generation.

uv methods

UV inspector Window

UV inspector is an Editor window for preview of UV coordinates. Press Open UV Inspector button to inspect primitive`s UV-s.

uv inspector window

Tangents recalculation

Tangents are mostly used in bump-mapped Shaders. Tangents mode specifies how tangents will be recalculated. Recalculation is require UV coordinates at suitable channel.

tangent

Raycast

Extended Primitive has its own scripted collider that allows you to perform Raycast on object without the using UnityEngine.Physics class or MeshCollider component. There is one parameter - Detalization based on visual detailization wich defined by Topology.

Commonly, a One Half Detalization are enough to make an object picking using Raycast.

Create Mesh Collider button creates MeshCollider component with assigned mesh snapshot of current state of scripted collider.

using UnityEngine; using ExtendedPrimitives_11; public class EpTutorial : MonoBehaviour { void Start () { FilletBox fb = FilletBox.Create(); Vector3 hitPoint = new Vector3(); float distance = 0; Ray ray = new Ray(Random.insideUnitSphere.normalized , Random.insideUnitSphere); if (fb.Collider.Raycast(ray, ref hitPoint, ref distance)) { Debug.LogFormat("ray {0} intersect {1} in point {2}", ray, fb.name, hitPoint); } } }

Statistic foldout

Statistic shows metric information about Mesh , Scripted collider, current update time in milliseconds, visualize mesh normals and tangents (if present)

statistic

Charts

Charts is a compound objects that handle multiple primitives at once. Charts elements is hidden by default. To display elements set toggle Display Primitives in Hierarchy. You can set child primitives parameters separately using their inspector or using chart`s override properties. chart

To set element values use inspector or via code:

Chart.Elements[int elementIndex].Value = float

Raycast to Chart

To perform Raycast to Chart use

Chart.Raycast(Ray r, ref Vector hit, ref float hitDistance, ref int elementIdx);

Charts can manage material`s propertyes of their elements. To display outline use outlined shader. Package include two outlined shader

Grid

Grids is an compound objects based on LineRender and TextMesh renderer. To display Grid`s labels:

grid1

grid2

Polyflow © 2019 polyflow3d@gmail.com