Beispiel #1
0
 public override void DrawGizmos()
 {
     if (GizmoContext.InSelection(this))
     {
         Draw.Line(start.position, end.position);
         Draw.Arrow((end.position - start.position) / 2f, rotation);
     }
 }
Beispiel #2
0
        private void OnDrawGizmos()
        {
            var transform1 = transform;
            var redColor   = new Color(1f, 0.35f, 0.43f);
            var halfRight  = new Vector3(.5f, 0, 0);

            // #4 Various drawing methods
            Draw.Text(Vector3.right, "Test", redColor, localTransform: transform1);
            Draw.Line(halfRight, Vector3.one + halfRight, localTransform: transform1);
            Draw.Arrow(Vector3.zero, -Vector3.one, redColor, localTransform: transform1);
            Draw.Circle(Vector3.zero, .5f, Vector3.up, color: Color.red, localTransform: transform1);
            Draw.Rectangle(Vector3.zero, new Vector2(3, 4), Vector3.forward, color: Color.red, localTransform: transform1);
            Draw.Point(Vector3.zero, localTransform: transform1);
            Draw.Sphere(Vector3.zero + Vector3.up, localTransform: transform1);
            Draw.PolyLine(_PolyLinePositions);
        }
Beispiel #3
0
    void Update()
    {
        Draw.Box(1, new float3(-2, 3, 0), quaternion.EulerYXZ(math.radians(new float3(20, 30, 40))), Color.green);
        Draw.Arrow(new float3(1, 2, 0), new float3(0, 1.7f, 0), Color.white);
        Draw.Transform(new float3(3, 2.5f, 0), quaternion.RotateY(math.radians(30)));
        Draw.Sphere(new float3(-2, .8f, 0), .85f, Color.black, 64);
        Draw.Cone(new float3(.2f, .1f, 0), 1, math.radians(20), Color.red);
        Draw.Circle(new float3(3.2f, .8f, 0), .7f, _normal, Color.yellow, 64);
        Draw.Text("++LINEBURST++", float4x4.TRS(new float3(-3.6f, -.4f, 0), quaternion.identity, new float3(1.6f)), Color.magenta);
        var a = Speed * Time.deltaTime;

        _normal = math.mul(quaternion.EulerYXZ(a, a, 0), _normal);


        var         size   = new float2(3);
        const float border = .5f;

        var pos   = new float2(5, 0);
        var graph = new Draw.Graph(pos, size, -math.PI, math.PI, 1);

        // Use IFunction for Burstable API
        graph.Plot(math.sin, 30, Color.red, "SIN");
        graph.Plot(math.cos, 30, Color.green, "COS");
        var explicitSamples = new NativeArray <float>(2, Allocator.Temp);

        explicitSamples[0] = -math.PI / 2;
        explicitSamples[1] = math.PI / 2;
        graph.Plot(math.tan, 30, Color.blue, "TAN", explicitSamples);

        pos.x += size.x + border;
        var s = new GraphSettings(pos, size * 2, -new float2(math.PI, .5f), math.PI, 1f / 3)
        {
            MarkingInterval    = 2,
            Title              = "THIS IS A TITLE",
            HorizontalAxisName = "HORIZONTAL AXIS",
            VerticalAxisName   = "VERTICAL AXIS"
        };

        graph = new Draw.Graph(s);
        graph.Plot(math.sin, 30, Color.red, "ALSO SIN");
    }
Beispiel #4
0
    protected override void OnUpdate()
    {
        var a = 1 * Time.DeltaTime;

        _normal = math.mul(quaternion.EulerYXZ(a, a, 0), _normal);
        var normal = _normal;

        Job
        .WithBurst()
        .WithCode(() =>
        {
            Draw.Box(1, new float3(-2, 3, 0), quaternion.EulerYXZ(math.radians(new float3(20, 30, 40))), Color.green);
            Draw.Arrow(new float3(1, 2, 0), new float3(0, 1.7f, 0), Color.white);
            Draw.Transform(new float3(3, 2.5f, 0), quaternion.RotateY(math.radians(30)));
            Draw.Sphere(new float3(-2, .8f, 0), .85f, Color.black, 64);
            Draw.Cone(new float3(.2f, .1f, 0), 1, math.radians(20), Color.red);
            Draw.Circle(new float3(3.2f, .8f, 0), .7f, normal, Color.yellow, 64);
            Draw.Text("++LINEBURST++", float4x4.TRS(new float3(-3.6f, -.4f, 0), quaternion.identity, new float3(1.6f)), Color.magenta);
        })
        .Schedule();
    }