Here are the examples of the csharp api UnityEngine.Gizmos.DrawWireCube(UnityEngine.Vector3, UnityEngine.Vector3) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
32 Examples
19
View Source File : Chunk.cs
License : MIT License
Project Creator : BrunoS3D
License : MIT License
Project Creator : BrunoS3D
public void DrawGizmos(Color color) {
if (World.currentWorld != null) {
Gizmos.color = color;
Vector3 cubeCenterPos = transform.position + (World.currentWorld.chunkSize / 2) + Vector3.back;
Gizmos.DrawWireCube(cubeCenterPos, World.currentWorld.chunkSize);
}
}
19
View Source File : StabilizationPlaneModifier.cs
License : MIT License
Project Creator : dag10
License : MIT License
Project Creator : dag10
private void OnDrawGizmos()
{
if (UnityEngine.Application.isPlaying)
{
Vector3 focalPlaneNormal = -Camera.main.transform.forward;
Vector3 planeUp = Vector3.Cross(Vector3.Cross(focalPlaneNormal, Vector3.up), focalPlaneNormal);
Gizmos.matrix = Matrix4x4.TRS(planePosition, Quaternion.LookRotation(focalPlaneNormal, planeUp), new Vector3(4.0f, 3.0f, 0.01f));
Color gizmoColor = Color.magenta;
gizmoColor.a = 0.5f;
Gizmos.color = gizmoColor;
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
Gizmos.DrawCube(Vector3.zero, Vector3.one);
}
}
19
View Source File : NetworkHitbox.cs
License : MIT License
Project Creator : deadgg
License : MIT License
Project Creator : deadgg
private void OnDrawGizmos()
{
Gizmos.color = new Color(0.2f, 0.2f, 1f, 0.3f);
Gizmos.matrix = Matrix4x4.TRS(transform.TransformPoint(_hitboxCenter), transform.rotation, transform.lossyScale);
Gizmos.DrawCube(Vector3.zero, _hitboxSize);
Gizmos.DrawWireCube(Vector3.zero, _hitboxSize);
}
19
View Source File : NavMeshModifierVolumeEditor.cs
License : MIT License
Project Creator : DKaravolos
License : MIT License
Project Creator : DKaravolos
[DrawGizmo(GizmoType.Selected | GizmoType.Active)]
static void RenderBoxGizmo(NavMeshModifierVolume navModifier, GizmoType gizmoType)
{
var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled;
var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f);
var oldColor = Gizmos.color;
var oldMatrix = Gizmos.matrix;
Gizmos.matrix = navModifier.transform.localToWorldMatrix;
Gizmos.color = colorTrans;
Gizmos.DrawCube(navModifier.center, navModifier.size);
Gizmos.color = color;
Gizmos.DrawWireCube(navModifier.center, navModifier.size);
Gizmos.matrix = oldMatrix;
Gizmos.color = oldColor;
Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true);
}
19
View Source File : NavMeshModifierVolumeEditor.cs
License : MIT License
Project Creator : DKaravolos
License : MIT License
Project Creator : DKaravolos
[DrawGizmo(GizmoType.NotInSelectionHierarchy | GizmoType.Pickable)]
static void RenderBoxGizmoNotSelected(NavMeshModifierVolume navModifier, GizmoType gizmoType)
{
if (NavMeshVisualizationSettings.showNavigation > 0)
{
var color = navModifier.enabled ? s_HandleColor : s_HandleColorDisabled;
var oldColor = Gizmos.color;
var oldMatrix = Gizmos.matrix;
Gizmos.matrix = navModifier.transform.localToWorldMatrix;
Gizmos.color = color;
Gizmos.DrawWireCube(navModifier.center, navModifier.size);
Gizmos.matrix = oldMatrix;
Gizmos.color = oldColor;
}
Gizmos.DrawIcon(navModifier.transform.position, "NavMeshModifierVolume Icon", true);
}
19
View Source File : NavMeshSurfaceEditor.cs
License : MIT License
Project Creator : DKaravolos
License : MIT License
Project Creator : DKaravolos
static void RenderBoxGizmo(NavMeshSurface navSurface, GizmoType gizmoType, bool selected)
{
var color = selected ? s_HandleColorSelected : s_HandleColor;
if (!navSurface.enabled)
color = s_HandleColorDisabled;
var oldColor = Gizmos.color;
var oldMatrix = Gizmos.matrix;
// Use the unscaled matrix for the NavMeshSurface
var localToWorld = Matrix4x4.TRS(navSurface.transform.position, navSurface.transform.rotation, Vector3.one);
Gizmos.matrix = localToWorld;
if (navSurface.collectObjects == CollectObjects.Volume)
{
Gizmos.color = color;
Gizmos.DrawWireCube(navSurface.center, navSurface.size);
if (selected && navSurface.enabled)
{
var colorTrans = new Color(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, color.a * 0.15f);
Gizmos.color = colorTrans;
Gizmos.DrawCube(navSurface.center, navSurface.size);
}
}
else
{
if (navSurface.navMeshData != null)
{
var bounds = navSurface.navMeshData.sourceBounds;
Gizmos.color = Color.grey;
Gizmos.DrawWireCube(bounds.center, bounds.size);
}
}
Gizmos.matrix = oldMatrix;
Gizmos.color = oldColor;
Gizmos.DrawIcon(navSurface.transform.position, "NavMeshSurface Icon", true);
}
19
View Source File : QuadTreeFix64Tester.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void OnDrawGizmos()
{
if (Application.isPlaying)
{
if (drawGridGizmos)
{
var grids = quadTree.GetNodeGrids();
var length = grids.Length;
for (int i = 0; i < length; i++)
{
Gizmos.color = gridGizmosColor;
var pos = new Vector3((float)grids[i].CenterX, 0, (float)grids[i].CenterY);
var size = new Vector3((float)grids[i].Width, 5, (float)grids[i].Height);
Gizmos.DrawWireCube(pos, size);
}
}
if (drawObjectGridGizmos)
{
var objs = quadTree.GetAllObjects();
for (int i = 0; i < objs.Length; i++)
{
Gizmos.color = objectGizmosColor;
var pos = objs[i].transform.position;
var size = Vector3.one * 0.5f;
Gizmos.DrawWireCube(pos, size);
}
}
}
}
19
View Source File : QuadTreeTester.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void OnDrawGizmos()
{
if (Application.isPlaying)
{
if (drawGridGizmos)
{
var grids = quadTree.GetNodeGrids();
var length = grids.Length;
for (int i = 0; i < length; i++)
{
Gizmos.color = gridGizmosColor;
var pos = new Vector3(grids[i].CenterX, 0, grids[i].CenterY);
var size = new Vector3(grids[i].Width, 5, grids[i].Height);
Gizmos.DrawWireCube(pos, size);
}
}
if (drawObjectGridGizmos)
{
var objs = quadTree.GetAllObjects();
for (int i = 0; i < objs.Length; i++)
{
Gizmos.color = objectGizmosColor;
var pos = objs[i].transform.position;
var size = Vector3.one * 0.5f;
Gizmos.DrawWireCube(pos, size);
}
}
}
}
19
View Source File : SquareGridRenderFix64.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void DrawSquareGrid()
{
var squares = squareGrid.GetAllSquares();
var slength= squares.Length;
for (int i = 0; i < slength; i++)
{
Gizmos.color = cellZoneColor;
var pos = new Vector3((float)squares[i].CenterX, 0, (float)squares[i].CenterY);
var size = new Vector3((float)squareGrid.CellSideLength, 6, (float)squareGrid.CellSideLength);
Gizmos.DrawWireCube(pos, size);
Gizmos.color = bufferZoneColor;
var cellSize = new Vector3((float)squareGrid.CellSideLength + cellBufferZoneBound * 2, 8, (float)squareGrid.CellSideLength + cellBufferZoneBound * 2);
Gizmos.DrawWireCube(pos, cellSize);
}
if (true)
{
var length = bufferZoneSquares.Length;
for (int i = 0; i < length; i++)
{
var tmpSquare = bufferZoneSquares[i];
Gizmos.color = heightLightColor;
var hlSize = new Vector3((float)tmpSquare.SideLength, 1, (float)tmpSquare.SideLength);
var hlPos = new Vector3((float)tmpSquare.CenterX, 0, (float)tmpSquare.CenterY);
Gizmos.DrawCube(hlPos, hlSize);
}
}
}
19
View Source File : SquareGridRender.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void DrawSquareGrid()
{
var squares = squareGrid.GetAllSquares();
var slength = squares.Length;
for (int i = 0; i < slength; i++)
{
Gizmos.color = cellZoneColor;
var pos = new Vector3(squares[i].CenterX, 0, squares[i].CenterY);
var size = new Vector3(squareGrid.CellSideLength, 6, squareGrid.CellSideLength);
Gizmos.DrawWireCube(pos, size);
Gizmos.color = bufferZoneColor;
var cellSize = new Vector3(squareGrid.CellSideLength + cellBufferZoneBound * 2, 8, squareGrid.CellSideLength + cellBufferZoneBound * 2);
Gizmos.DrawWireCube(pos, cellSize);
}
if (true)
{
var length = bufferZoneSquares.Length;
for (int i = 0; i < length; i++)
{
var tmpSquare = bufferZoneSquares[i];
Gizmos.color = heightLightColor;
var hlSize = new Vector3(tmpSquare.SideLength, 1, tmpSquare.SideLength);
var hlPos = new Vector3(tmpSquare.CenterX, 0, tmpSquare.CenterY);
Gizmos.DrawCube(hlPos, hlSize);
}
}
}
19
View Source File : QuadTreeFix64Tester.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void OnDrawGizmos()
{
if (Application.isPlaying)
{
if (drawGridGizmos)
{
var grids = quadTree.GetNodeGrids();
var length = grids.Length;
for (int i = 0; i < length; i++)
{
Gizmos.color = gridGizmosColor;
var pos = new Vector3((float)grids[i].CenterX, 0, (float)grids[i].CenterY);
var size = new Vector3((float)grids[i].Width, 5, (float)grids[i].Height);
Gizmos.DrawWireCube(pos, size);
}
}
if (drawObjectGridGizmos)
{
var objs = quadTree.GetAllObjects();
for (int i = 0; i < objs.Length; i++)
{
Gizmos.color = objectGizmosColor;
var pos = objs[i].transform.position;
var size = Vector3.one * 0.5f;
Gizmos.DrawWireCube(pos, size);
}
}
}
}
19
View Source File : QuadTreeTester.cs
License : MIT License
Project Creator : DonnYep
License : MIT License
Project Creator : DonnYep
void OnDrawGizmos()
{
if (Application.isPlaying)
{
if (drawGridGizmos)
{
var grids = quadTree.GetNodeGrids();
var length = grids.Length;
for (int i = 0; i < length; i++)
{
Gizmos.color = gridGizmosColor;
var pos = new Vector3(grids[i].CenterX, 0, grids[i].CenterY);
var size = new Vector3(grids[i].Width, 5, grids[i].Height);
Gizmos.DrawWireCube(pos, size);
}
}
if (drawObjectGridGizmos)
{
var objs = quadTree.GetAllObjects();
for (int i = 0; i < objs.Length; i++)
{
Gizmos.color = objectGizmosColor;
var pos = objs[i].transform.position;
var size = Vector3.one * 0.5f;
Gizmos.DrawWireCube(pos, size);
}
}
}
}
19
View Source File : PredatorAI.cs
License : MIT License
Project Creator : Donut-Studios
License : MIT License
Project Creator : Donut-Studios
private void OnDrawGizmos()
{
Gizmos.DrawWireCube(last_position, Vector3.one);
Gizmos.DrawWireSphere(this.transform.position, personal_space);
Gizmos.DrawRay(player_line_of_sight);
Gizmos.DrawRay(line_of_sight);
}
19
View Source File : LocalNavMeshBuilder.cs
License : MIT License
Project Creator : Donut-Studios
License : MIT License
Project Creator : Donut-Studios
void OnDrawGizmosSelected()
{
if (m_NavMesh)
{
Gizmos.color = Color.green;
Gizmos.DrawWireCube(m_NavMesh.sourceBounds.center, m_NavMesh.sourceBounds.size);
}
Gizmos.color = Color.yellow;
var bounds = QuantizedBounds();
Gizmos.DrawWireCube(bounds.center, bounds.size);
Gizmos.color = Color.green;
var center = m_Tracked ? m_Tracked.position : transform.position;
Gizmos.DrawWireCube(center, m_Size);
}
19
View Source File : LocalNavMeshBuilder.cs
License : MIT License
Project Creator : Donut-Studios
License : MIT License
Project Creator : Donut-Studios
void OnDrawGizmosSelected()
{
if (m_NavMesh)
{
Gizmos.color = Color.green;
Gizmos.DrawWireCube(m_NavMesh.sourceBounds.center, m_NavMesh.sourceBounds.size);
}
Gizmos.color = Color.yellow;
var bounds = QuantizedBounds();
Gizmos.DrawWireCube(bounds.center, bounds.size);
Gizmos.color = Color.green;
var center = m_Tracked ? m_Tracked.position : transform.position;
Gizmos.DrawWireCube(center, m_Size);
}
19
View Source File : Joystick.cs
License : GNU General Public License v3.0
Project Creator : hansquirrel
License : GNU General Public License v3.0
Project Creator : hansquirrel
void OnDrawGizmos() {
/* This is all the visual stuff to help visualize the bounds for the joystick */
Vector3 lastpos;
if (!Application.isPlaying) {
lastpos = transform.position;
last= lastpos;
}
Gizmos.DrawWireCube (last, new Vector3 (TouchAria.x, TouchAria.y, .1f));
}
19
View Source File : TouchPad.cs
License : GNU General Public License v3.0
Project Creator : hansquirrel
License : GNU General Public License v3.0
Project Creator : hansquirrel
void OnDrawGizmos() {
/* This is all the visual stuff to help visualize the Touch Pad*/
Vector3 lastpos;
FingerS = new Vector3 (FingerSize.x, FingerSize.y, .4f);
if (useImageSizeAsTouchAria && gameObject.GetComponent<Image>()) {
Image ImageToUse = gameObject.GetComponent<Image>();
TouchAria = new Vector2(ImageToUse.GetComponent<RectTransform>().rect.width,ImageToUse.GetComponent<RectTransform>().rect.height);
}
if (!Application.isPlaying) {
lastpos = transform.position;
last= lastpos;
Finger = transform.position;
}
Gizmos.DrawCube (Finger, FingerS);
Gizmos.DrawWireCube (last, new Vector3 (TouchAria.x, TouchAria.y, .1f));
}
19
View Source File : GvrAudioRoom.cs
License : MIT License
Project Creator : harshitjuneja
License : MIT License
Project Creator : harshitjuneja
void OnDrawGizmosSelected () {
// Draw shoebox model wireframe of the room.
Gizmos.color = Color.yellow;
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawWireCube(Vector3.zero, size);
}
19
View Source File : AttackTrigger.cs
License : MIT License
Project Creator : Interactml
License : MIT License
Project Creator : Interactml
void OnDrawGizmos()
{
if (Application.isPlaying)
{
Gizmos.color = DebugColor;
Gizmos.matrix = transform.localToWorldMatrix;
if (Collider && Collider.enabled)
{
if (Collider is BoxCollider)
{
BoxCollider _C = Collider as BoxCollider;
if (!_C.enabled) return;
var sizeX = transform.lossyScale.x * _C.size.x;
var sizeY = transform.lossyScale.y * _C.size.y;
var sizeZ = transform.lossyScale.z * _C.size.z;
Matrix4x4 rotationMatrix = Matrix4x4.TRS(_C.bounds.center, transform.rotation, new Vector3(sizeX, sizeY, sizeZ));
Gizmos.matrix = rotationMatrix;
Gizmos.DrawCube(Vector3.zero, Vector3.one);
Gizmos.color = new Color(DebugColor.r, DebugColor.g, DebugColor.b, 1f);
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
}
else if (Collider is SphereCollider)
{
SphereCollider _C = Collider as SphereCollider;
if (!_C.enabled) return;
Gizmos.matrix = transform.localToWorldMatrix;
Gizmos.DrawSphere(Vector3.zero + _C.center, _C.radius);
Gizmos.color = new Color(DebugColor.r, DebugColor.g, DebugColor.b, 1f);
Gizmos.DrawWireSphere(Vector3.zero + _C.center, _C.radius);
}
}
}
}
19
View Source File : GizmoHelper.cs
License : MIT License
Project Creator : IxxyXR
License : MIT License
Project Creator : IxxyXR
public static void DrawGizmos(ConwayPoly poly, Transform transform,
bool vertexGizmos = false, bool faceGizmos = false, bool edgeGizmos = false, bool faceCenterGizmos = false,
bool faceOrientationGizmos = false, float scale = 1.0f)
{
float GizmoRadius = .03f * scale;
if (vertexGizmos && poly!=null)
{
Gizmos.color = Color.white;
if (poly.Vertices != null)
{
for (int i = 0; i < poly.Vertices.Count; i++)
{
Vector3 vert = poly.Vertices[i].Position;
Vector3 pos = transform.TransformPoint(vert);
// Gizmos.DrawWireSphere(pos, GizmoRadius);
Handles.Label(pos + new Vector3(0, 0, 0), i.ToString());
}
}
}
if (faceCenterGizmos)
{
Gizmos.color = Color.green;
foreach (var f in poly.Faces)
{
Gizmos.DrawWireSphere(transform.TransformPoint(f.Centroid), GizmoRadius);
Gizmos.DrawRay(transform.TransformPoint(f.Centroid), f.Normal);
}
}
if (faceGizmos)
{
int gizmoColor = 0;
var faces = poly.Faces;
for (int f = 0; f < faces.Count; f++)
{
Gizmos.color = Color.white;
var face = faces[f];
var faceVerts = face.GetVertices();
for (int i = 0; i < faceVerts.Count; i++)
{
var edgeStart = faceVerts[i];
var edgeEnd = faceVerts[(i + 1) % faceVerts.Count];
Gizmos.DrawLine(
transform.TransformPoint(edgeStart.Position),
transform.TransformPoint(edgeEnd.Position)
);
}
string label;
// label = $"{f}:{face.Normal}";
// label = poly.FaceRoles[f].ToString();
label = $"{f}";
Handles.Label(Vector3.Scale(face.Centroid, transform.lossyScale) + new Vector3(0, 0.03f * scale, 0), label);
}
}
if (edgeGizmos)
{
for (int i = 0; i < poly.Halfedges.Count; i++)
{
Gizmos.color = Color.yellow;
var edge = poly.Halfedges[i];
Gizmos.DrawLine(
transform.TransformPoint(edge.Vertex.Position),
transform.TransformPoint(edge.Next.Vertex.Position)
);
// string label = $"{i}";
// Handles.Label(transform.TransformPoint(edge.PointAlongEdge(0.9f)), label);
Gizmos.DrawWireCube(transform.TransformPoint(edge.PointAlongEdge(0.9f)), Vector3.one * 0.02f * scale);
}
}
if (faceOrientationGizmos)
{
Gizmos.color = Color.yellow;
for (var i = 0; i < poly.Faces.Count; i++)
{
var face = poly.Faces[i];
var target = face.GetBestEdge().Midpoint;
Gizmos.DrawLine(
transform.TransformPoint(face.Centroid),
transform.TransformPoint(target)
);
Gizmos.DrawSphere(transform.TransformPoint(target), 0.07f);
Gizmos.DrawWireSphere(transform.TransformPoint(face.Centroid), 0.025f);
}
}
}
19
View Source File : BoundsOctreeNode.cs
License : MIT License
Project Creator : IxxyXR
License : MIT License
Project Creator : IxxyXR
public void DrawAllBounds(float depth = 0) {
float tintVal = depth / 7; // Will eventually get values > 1. Color rounds to 1 automatically
Gizmos.color = new Color(tintVal, 0, 1.0f - tintVal);
Bounds thisBounds = new Bounds(Center, new Vector3(adjLength, adjLength, adjLength));
Gizmos.DrawWireCube(thisBounds.center, thisBounds.size);
if (children != null) {
depth++;
for (int i = 0; i < 8; i++) {
children[i].DrawAllBounds(depth);
}
}
Gizmos.color = Color.white;
}
19
View Source File : PointOctreeNode.cs
License : MIT License
Project Creator : IxxyXR
License : MIT License
Project Creator : IxxyXR
public void DrawAllBounds(float depth = 0) {
float tintVal = depth / 7; // Will eventually get values > 1. Color rounds to 1 automatically
Gizmos.color = new Color(tintVal, 0, 1.0f - tintVal);
Bounds thisBounds = new Bounds(Center, new Vector3(SideLength, SideLength, SideLength));
Gizmos.DrawWireCube(thisBounds.center, thisBounds.size);
if (children != null) {
depth++;
for (int i = 0; i < 8; i++) {
children[i].DrawAllBounds(depth);
}
}
Gizmos.color = Color.white;
}
19
View Source File : LinearArrayFeature.cs
License : GNU General Public License v3.0
Project Creator : NoteCAD
License : GNU General Public License v3.0
Project Creator : NoteCAD
void DrawGizmoBounds(Bounds bb, Color color) {
if(!drawGizmos) return;
if(drawGizmos) {
Gizmos.color = color;
Gizmos.DrawWireCube(bb.center, bb.size);
}
}
19
View Source File : DetailEditor.cs
License : GNU General Public License v3.0
Project Creator : NoteCAD
License : GNU General Public License v3.0
Project Creator : NoteCAD
private void OnDrawGizmos() {
if(currentSketch != null) {
var bounds = currentSketch.bounds;
if(currentSketch is LinearArrayFeature) {
var laf = currentSketch as LinearArrayFeature;
laf.DrawGizmos(Input.mousePosition, Camera.main);
} else {
Gizmos.DrawWireCube(bounds.center, bounds.size);
}
}
}
19
View Source File : Grid.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
void OnDrawGizmos() {
Gizmos.DrawWireCube(transform.position,new Vector3(gridWorldSize.x,1,gridWorldSize.y));
if (onlyDisplayPathGizmos) {
if (path != null) {
foreach (Node n in path) {
Gizmos.color = Color.black;
Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
}
}
}
else {
if (grid != null) {
foreach (Node n in grid) {
Gizmos.color = (n.walkable)?Color.white:Color.red;
if (path != null)
if (path.Contains(n))
Gizmos.color = Color.black;
Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
}
}
}
}
19
View Source File : Grid.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
void OnDrawGizmos() {
Gizmos.DrawWireCube(transform.position,new Vector3(gridWorldSize.x,1,gridWorldSize.y));
if (grid != null) {
foreach (Node n in grid) {
Gizmos.color = (n.walkable)?Color.white:Color.red;
Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
}
}
}
19
View Source File : Grid.cs
License : MIT License
Project Creator : PacktPublishing
License : MIT License
Project Creator : PacktPublishing
void OnDrawGizmos() {
Gizmos.DrawWireCube(transform.position,new Vector3(gridWorldSize.x,1,gridWorldSize.y));
if (grid != null) {
foreach (Node n in grid) {
Gizmos.color = (n.walkable)?Color.white:Color.red;
if (path != null)
if (path.Contains(n))
Gizmos.color = Color.black;
Gizmos.DrawCube(n.worldPosition, Vector3.one * (nodeDiameter-.1f));
}
}
}
19
View Source File : StabilizationPlaneModifier.cs
License : MIT License
Project Creator : pampas93
License : MIT License
Project Creator : pampas93
private void OnDrawGizmos()
{
if (Application.isPlaying && DrawGizmos)
{
Vector3 focalPlaneNormal = -GazeNormal;
Vector3 planeUp = Vector3.Cross(Vector3.Cross(focalPlaneNormal, Vector3.up), focalPlaneNormal);
Gizmos.matrix = Matrix4x4.TRS(planePosition, Quaternion.LookRotation(focalPlaneNormal, planeUp), new Vector3(4.0f, 3.0f, 0.01f));
Color gizmoColor = Color.magenta;
gizmoColor.a = 0.5f;
Gizmos.color = gizmoColor;
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
Gizmos.DrawCube(Vector3.zero, Vector3.one);
}
}
19
View Source File : ONSPAudioSource.cs
License : MIT License
Project Creator : Tobbse
License : MIT License
Project Creator : Tobbse
void OnDrawGizmos()
{
// Are we the first one created? make sure to set our static ONSPAudioSource
// for drawing out room parameters once
if(RoomReflectionGizmoAS == null)
{
RoomReflectionGizmoAS = this;
}
Color c;
const float colorSolidAlpha = 0.1f;
// Draw the near/far spheres
// Near (orange)
c.r = 1.0f;
c.g = 0.5f;
c.b = 0.0f;
c.a = 1.0f;
Gizmos.color = c;
Gizmos.DrawWireSphere(transform.position, Near);
c.a = colorSolidAlpha;
Gizmos.color = c;
Gizmos.DrawSphere(transform.position, Near);
// Far (red)
c.r = 1.0f;
c.g = 0.0f;
c.b = 0.0f;
c.a = 1.0f;
Gizmos.color = Color.red;
Gizmos.DrawWireSphere(transform.position, Far);
c.a = colorSolidAlpha;
Gizmos.color = c;
Gizmos.DrawSphere(transform.position, Far);
// VolumetricRadius (purple)
c.r = 1.0f;
c.g = 0.0f;
c.b = 1.0f;
c.a = 1.0f;
Gizmos.color = c;
Gizmos.DrawWireSphere(transform.position, VolumetricRadius);
c.a = colorSolidAlpha;
Gizmos.color = c;
Gizmos.DrawSphere(transform.position, VolumetricRadius);
// Draw room parameters ONCE only, provided reflection engine is on
if (RoomReflectionGizmoAS == this)
{
// Get global room parameters (write new C api to get reflection values)
bool reflOn = false;
bool reverbOn = false;
float width = 1.0f;
float height = 1.0f;
float length = 1.0f;
ONSP_GetGlobalRoomReflectionValues(ref reflOn, ref reverbOn, ref width, ref height, ref length);
// TO DO: Get the room reflection values and render those out as well (like we do in the VST)
if((Camera.main != null) && (reflOn == true))
{
// Set color of cube (cyan is early reflections only, white is with reverb on)
if(reverbOn == true)
c = Color.white;
else
c = Color.cyan;
Gizmos.color = c;
Gizmos.DrawWireCube(Camera.main.transform.position, new Vector3(width, height, length));
c.a = colorSolidAlpha;
Gizmos.color = c;
Gizmos.DrawCube(Camera.main.transform.position, new Vector3(width, height, length));
}
}
}
19
View Source File : Extensions.cs
License : MIT License
Project Creator : WurstModders
License : MIT License
Project Creator : WurstModders
public static void GenericGizmoCubeOutline(Color color, Vector3 center, Vector3 size, params Transform[] markers)
{
Gizmos.color = color;
foreach (Transform ii in markers)
{
Gizmos.matrix = ii.localToWorldMatrix;
Gizmos.DrawWireCube(center, size);
}
}
19
View Source File : GraphUpdateScene.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
void OnDrawGizmos (bool selected) {
Color c = selected ? new Color(227/255f, 61/255f, 22/255f, 1.0f) : new Color(227/255f, 61/255f, 22/255f, 0.9f);
if (selected) {
Gizmos.color = Color.Lerp(c, new Color(1, 1, 1, 0.2f), 0.9f);
Bounds b = GetBounds();
Gizmos.DrawCube(b.center, b.size);
Gizmos.DrawWireCube(b.center, b.size);
}
if (points == null) return;
if (convex) c.a *= 0.5f;
Gizmos.color = c;
Matrix4x4 matrix = legacyMode && legacyUseWorldSpace ? Matrix4x4.idenreplacedy : transform.localToWorldMatrix;
if (convex) {
c.r -= 0.1f;
c.g -= 0.2f;
c.b -= 0.1f;
Gizmos.color = c;
}
if (selected || !convex) {
for (int i = 0; i < points.Length; i++) {
Gizmos.DrawLine(matrix.MultiplyPoint3x4(points[i]), matrix.MultiplyPoint3x4(points[(i+1)%points.Length]));
}
}
if (convex) {
if (convexPoints == null) RecalcConvex();
Gizmos.color = selected ? new Color(227/255f, 61/255f, 22/255f, 1.0f) : new Color(227/255f, 61/255f, 22/255f, 0.9f);
for (int i = 0; i < convexPoints.Length; i++) {
Gizmos.DrawLine(matrix.MultiplyPoint3x4(convexPoints[i]), matrix.MultiplyPoint3x4(convexPoints[(i+1)%convexPoints.Length]));
}
}
// Draw the full 3D shape
var pts = convex ? convexPoints : points;
if (selected && pts != null && pts.Length > 0) {
Gizmos.color = new Color(1, 1, 1, 0.2f);
float miny = pts[0].y, maxy = pts[0].y;
for (int i = 0; i < pts.Length; i++) {
miny = Mathf.Min(miny, pts[i].y);
maxy = Mathf.Max(maxy, pts[i].y);
}
var extraHeight = Mathf.Max(minBoundsHeight - (maxy - miny), 0) * 0.5f;
miny -= extraHeight;
maxy += extraHeight;
for (int i = 0; i < pts.Length; i++) {
var next = (i+1) % pts.Length;
var p1 = matrix.MultiplyPoint3x4(pts[i] + Vector3.up*(miny - pts[i].y));
var p2 = matrix.MultiplyPoint3x4(pts[i] + Vector3.up*(maxy - pts[i].y));
var p1n = matrix.MultiplyPoint3x4(pts[next] + Vector3.up*(miny - pts[next].y));
var p2n = matrix.MultiplyPoint3x4(pts[next] + Vector3.up*(maxy - pts[next].y));
Gizmos.DrawLine(p1, p2);
Gizmos.DrawLine(p1, p1n);
Gizmos.DrawLine(p2, p2n);
}
}
}
19
View Source File : GizmosExtensions.cs
License : MIT License
Project Creator : XINCGer
License : MIT License
Project Creator : XINCGer
public static void DrawWireCube(Vector3 center, Vector3 size, Quaternion rotation = default(Quaternion))
{
var old = Gizmos.matrix;
if (rotation.Equals(default(Quaternion)))
rotation = Quaternion.idenreplacedy;
Gizmos.matrix = Matrix4x4.TRS(center, rotation, size);
Gizmos.DrawWireCube(Vector3.zero, Vector3.one);
Gizmos.matrix = old;
}