BezierTo breaks when aligned on the YZ plane
BezierTo produces a straight line, rather than the expected curve, when everything is aligned in the YZ plane.
I've attached an example below. The first polyline is the wrong one. The other two -- one with a slight adjustment and one in the XZ plane -- are behaving properly. Any deviation from alignment appears to make it work correctly.
using System.Collections; using System.Collections.Generic; using UnityEngine; using Shapes; public class ShapeTest : ImmediateModeShapeDrawer { public override void DrawShapes(Camera cam) { using (Draw.Command(cam)) { Draw.LineGeometry = LineGeometry.Flat2D; Draw.ThicknessSpace = ThicknessSpace.Pixels; Draw.Thickness = 4; using (var p = new PolylinePath()) { p.AddPoint(Vector3.zero); p.BezierTo(5 * Vector3.up, 5 * Vector3.up + Vector3.forward, Vector3.forward); Draw.Polyline(p); } using (var p = new PolylinePath()) { p.AddPoint(Vector3.zero); p.BezierTo(5 * Vector3.up, 5 * Vector3.up + Vector3.forward + Vector3.right * 0.001f, Vector3.forward); Draw.Polyline(p); } using (var p = new PolylinePath()) { p.AddPoint(Vector3.zero); p.BezierTo(5 * Vector3.up, 5 * Vector3.up + Vector3.right, Vector3.right); Draw.Polyline(p); } } } }
this is because you've set LineGeometry to Flat2D, which works only on the XY axis. if you want to draw on a different plane, you'll want to rotate the drawing matrix so that the local drawing happens in the XY plane, but it's rendered in your XZ plane.
You can use Draw.Rotate or set Draw.Matrix directly