Gizmo Capsule#
Debug / Gizmos / Gizmo Capsule
Description#
Displays a capsule gizmo between two points in the scene
Parameters#
| Name | Description |
|---|---|
| Mode | Whether to display a solid or a wireframe capsule |
| Start | The position of the first cap of the capsule |
| End | The position of the second cap of the capsule |
| Radius | The radius of the capsule |
| Color | The color of the capsule |
| Duration | The amount of seconds the capsule will be displayed |
Code#
using System;
using UnityEngine;
using VisualScript.Icons;
namespace VisualScript.Runtime
{
[Title("Gizmo Capsule")]
[Image(typeof(IconCapsuleSolid), ColorTheme.Type.Lime)]
[Description("Displays a capsule gizmo between two points in the scene")]
[Category("Debug/Gizmos/Capsule")]
[Parameter("Mode", "Whether to display a solid or a wireframe capsule")]
[Parameter("Start", "The position of the first cap of the capsule")]
[Parameter("End", "The position of the second cap of the capsule")]
[Parameter("Radius", "The radius of the capsule")]
[Parameter("Color", "The color of the capsule")]
[Parameter("Duration", "The amount of seconds the capsule will be displayed")]
[Keywords("Draw", "Debug", "Gizmo", "Pill")]
[Serializable]
public class InstructionCoreDebugGizmoCapsule : Instruction
{
[SerializeField] private GizmoMode m_Mode = GizmoMode.Outline;
[SerializeField] private GetVector3 m_Start = new GetVector3();
[SerializeField] private GetVector3 m_End = new GetVector3(Vector3.up);
[SerializeField] private GetNumber m_Radius = new GetNumber(0.5f);
[SerializeField] private GetColor m_Color = new GetColor(Color.green.SetAlpha(0.5f));
[SerializeField] private GetNumber m_Duration = new GetNumber(1f);
protected override string GetTitle(GameObject source) => $"Display {this.m_Mode} Capsule from {this.m_Start} to {this.m_End}";
protected override Awaitable Run(Args args)
{
GizmosManager.Capsule3D(
this.m_Start.Get(args),
this.m_End.Get(args),
this.m_Radius.GetFloat(args),
this.m_Color.Get(args),
this.m_Mode,
this.m_Duration.GetFloat(args)
);
return Done;
}
}
}