MonoGame.SplineFlower - Create wonderful smooth Bézier Splines!

I’ll continue my inquiry here instead ^_^y sorry tweetter has little text to offer : - D

Here it goes bro,

I have a function that returns a Points from a given line Start-Position and End-Position with a given Contour in the middle, can I extract the points position and it’s cotour from the editor ?

E;g:

Start, Counter, End

1, 1.5, 2
2, 2.5, 3
3, 3.5, 4

This my function looks like

/// <summary>
/// Curve to points.
/// </summary>
/// <param name="pStart">Line start point</param>
/// <param name="pEnd">Line end point</param>
//  <param name="pContour">Curve center contour</param>
/// <param name="pSegment">Desired number of segment</param>
/// <returns></returns>
public static Vector3[] CreateCurvePointsFromLine( Vector3 pStart, Vector3 pEnd, Vector3 pContour, int pSegment )
{
    return CreateCurvePointsFromLine(ref pStart, ref pEnd, ref pContour, pSegment );
}

mFrom = 1;
mContour = 1.5;
mTo = 2;

var Vector3[] CreateCurvePointsFromLine( mFrom, mContour, mEnd, 4 );

This will give 4 points as shown below

To make the long story short bro, can I extract the lines position with a contour?

.

And my Inquiry on tweeter when I compile :

I’m trying to understand your problem with the points:

Do you want to convert the points from your function to a spline and make this spline visible in the editor?

To your compilation issue:

Have you tried to restore the nuget packages?

Do you want to convert the points from your function to a spline and make this spline visible in the editor?

I just need the points to follow, can I export the points from your editor and save it in a text file all the points of the car to follow as on your example:

Have you tried to restore the nuget packages?

I download it directly your from your github, I’ll try nuget instead ^_^y

EDIT: Works the restore nuget and dependencies are ok,

One more problem which I always encountered on using MVSC 2017, i’'ll try to compile it on MVSC 2015 and plays with it… Thanks ^_^Y

You can export the whole spline as a json file. This file contains all the point data:

Click on “File->Export JSON” in the editor and chose a save location. You can open the json file with any text editor. If you need help loading this data back to your environment then don’t hesitate to ask. I will help you bro :slight_smile:

This is a picture from the internet. The right option is not selected here. It’s the one below the red marker “Restore NuGet Packages”.

Click on that and see if it resolves your issue with missing DLLs.

Edit: Ah, I see it helped. The two error messages on the top are just post build events. You don’t need them on your side. You can delete them in the project “Properties->Build Events” section.

1 Like

Ah there the json file is all i needed ^_^y but I still have some problem compiling the editor.

Using MVSC 2015

  • GameTest - Compiles and run successfully ^_^y

  • Sample - Compiles and run successfully ^_^y

  • Editor - Compiles but when run NullReferrenceException T_T

Hm, weird for me it works :thinking:

Is the splineControl null or the MySplineWalker?

The splineControl should already be initialized at this point.

splineControl is null, can you download whats in your github if it is runnable or
probably a link for a working binary for me to start testing it ^_^y

Try this:
https://drive.google.com/file/d/1oQdj0vWEC-kwu8mgD4Hncv6trmPB6ek3/view?usp=sharing

1 Like

Excellent ^_^y I can managed the Json exported file, many thanks Marcel!

1 Like

MonoGame.SplineFlower 1.3.0 - Rotate, Scale, ScaleRotate, CenterTransform


By clicking and dragging the orange transform it’s possible to do this now:

  • Renamed ShowBezierSpline to ShowSpline.

  • Added ShowCenterTransform to make it possible to hide or show the transform in the center of the spline.

  • Only calculating the CenterTransform when necessary.

  • It’s now possible to programmatically create a spline by using the new constructor.

  • Added CenterTransformMode “None”. On this mode the whole spline can be moved by dragging the CenterSpline with the left mouse button.

  • Fixed that points which could be placed exactly at the start point (index 0) could resulting in wrong calculations.

  • After importing a spline the newly imported spline will be placed on the center of the screen.

  • Added NuGetRelease configuration so that if building in Release configuration, it wouldn’t result in compilation errors on the users end, because of the post build commands. @DexterZ

  • It’s now possible to change the CenterTransformMode (Rotate, Scale, ScaleRotate) in the Sample- and Editor project.

  • Fixed IndexOutOfRangeException when the CurrentTriggerIndex was -1 in the SplineWalker class.

  • Added additional NullReference checks for the splineControl and the splineControl.MySplineWalker. @DexterZ

  • It’s now possible to scale the whole spline by dragging the CenterSpline transform with the left mouse button.

  • It’s now possible to rotate and scale-rotate the whole spline.

  • Added public bool IsCenterSpline to check if a Transform is the center of the spline or not.

  • Renamed GetSplineCenter to CenterSpline.

  • Added checks to determine if a Transform is a point on a spline or the CenterTransform.

  • Removed LineControl sample and CurveControl sample from the project.

  • Extended GameSample to demonstrate new features.

The orange transform will always be in the center of the spline:


This update should improve MonoGame.SplineFlower by alot.

Hope you like it and make good use of it.

Cheers,
Marcel

PS: New NuGet packages online! :wink:

1 Like

That’s exactly what I’m doing on the json file output, points can be switch to Z or Y axis in 3D, I’m using it for the AI paths of my enemies ships in 3D, same paths but when rotated and scaled it becomes seemless and not a pattern, a must have tools ^_^y

1 Like

Pretty nice, yes :slight_smile:

I saw it in this video from you:

Looks very smooth and awesome!

1 Like

Yes but the ships AI paths is hard coded it’s just no. 8 paths rotated by matrix just (1)one paths T_T … But now I can create many paths visually by your using tools! YAY!

EDIT : BTW the latest release compiled and run successfully! many thanks ^_^Y

1 Like

That’s cool :slight_smile:

Thanks for responding back on this. Good to hear that it’s working now for you :sunglasses:

1 Like

Hey sqrMin1. Apologies for the bump. This exactly what I need, great tool you made. However I am having a problem using the content pipeline importer. I’ve installed from nuget, and added MonoGame.SplineFlower.Content.Pipeline.dll as a reference in the content manager, but I don’t see the option to select the importer and processor after doing this. I’m on VS2017. Is there a step I missed here?

Hey @Oven_Owl and thanks for the report.

You are right, there is an error within the packages (missing libraries).

I will fix them and publish new packages soon.

Thanks!

1 Like

Awesome thank you very much :slight_smile:

New packages up!

Try it with version 1.3.0.1:



Nice one mate, all working now :slight_smile:

If your curios, we are going to use it for creating attack patterns in a side scrolling shoot em up. Exactly the tool we needed you had made!

1 Like

Nice to hear!

Feel free to share your creations :slight_smile: