BezierCurves.BezierCurve3DEditor.AddDefaultPoints C# (CSharp) Method

AddDefaultPoints() private static method

private static AddDefaultPoints ( BezierCurve3D curve ) : void
curve BezierCurve3D
return void
        private static void AddDefaultPoints(BezierCurve3D curve)
        {
            BezierPoint3D startPoint = curve.AddKeyPoint();
            startPoint.LocalPosition = new Vector3(-1f, 0f, 0f);
            startPoint.LeftHandleLocalPosition = new Vector3(-0.35f, -0.35f, 0f);

            BezierPoint3D endPoint = curve.AddKeyPoint();
            endPoint.LocalPosition = new Vector3(1f, 0f, 0f);
            endPoint.LeftHandleLocalPosition = new Vector3(-0.35f, 0.35f, 0f);
        }

Usage Example

Example #1
0
        private static void CreateBezeirCurve()
        {
            BezierCurve3D curve    = new GameObject("Bezier Curve", typeof(BezierCurve3D)).GetComponent <BezierCurve3D>();
            Vector3       position = Vector3.zero;

            if (Camera.current != null)
            {
                position = Camera.current.transform.position + Camera.current.transform.forward * 10f;
            }

            curve.transform.position = position;

            BezierCurve3DEditor.AddDefaultPoints(curve);

            Undo.RegisterCreatedObjectUndo(curve.gameObject, "Create Curve");

            Selection.activeGameObject = curve.gameObject;
        }
All Usage Examples Of BezierCurves.BezierCurve3DEditor::AddDefaultPoints