Exemple #1
0
    public override void Redraw(EditorSpatialGizmo gizmo)
    {
        if (!Engine.EditorHint)
        {
            return;
        }

        return;

        gizmo.Clear();

        var spatial = gizmo.GetSpatialNode() as VehicleRigidWheel;
        var t       = spatial.GlobalTransform;

        var p1 = t.origin + t.basis.y * VehicleRigidWheel.k_ExtraRayLength;
        var p2 = t.origin - t.basis.y * (spatial.RayLength - VehicleRigidWheel.k_ExtraRayLength);

        var lines = new List <Vector3>();

        lines.Add(spatial.ToLocal(p1));
        lines.Add(spatial.ToLocal(p2));


        int skip = 10;

        gizmo.AddLines(lines.ToArray(), GetMaterial("front", gizmo), false, Colors.Red);
        lines.Clear();

        for (int ix = 0; ix < 360; ix += skip)
        {
            var ra = Mathf.Deg2Rad(ix);
            var rb = Mathf.Deg2Rad(ix + skip);

            var a = new Vector2(Mathf.Sin(ra), Mathf.Cos(ra)) * spatial.radius;
            var b = new Vector2(Mathf.Sin(rb), Mathf.Cos(rb)) * spatial.radius;

            lines.Add(new Vector3(0, a.x, a.y));
            lines.Add(new Vector3(0, b.x, b.y));
        }


        gizmo.AddLines(lines.ToArray(), GetMaterial("front", gizmo), false, Colors.Yellow);
    }
    public override void Redraw(EditorSpatialGizmo gizmo)
    {
        gizmo.Clear();
        var spatial = gizmo.GetSpatialNode();

        var lines = new List <Vector3>();

        lines.Add(new Vector3(0, 1, 0));
        // lines.Add(new Vector3(0, spatial.my_custom_value, 0));

        var handles = new List <Vector3>();

        handles.Add(new Vector3(0, 1, 0));
        //handles.Add(new Vector3(0, spatial.my_custom_value, 0));

        gizmo.AddLines(lines.ToArray(), GetMaterial("main", gizmo), false);
        gizmo.AddHandles(handles.ToArray(), GetMaterial("handles", gizmo));
    }