Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

BGCurve (free Bezier Spline Editor) support thread

Discussion in 'Assets and Asset Store' started by BansheeGz, Feb 18, 2017.

  1. Redrag

    Redrag

    Joined:
    Apr 27, 2014
    Posts:
    179
    The message shows up every frame while the BGCurve gameobject is selected at runtime only. Also get the error when any of the child objects are selected. I am using control type 'absent'.

    The math.recalcualte is working great. All lagging has gone and everything is being processed at the right time.

    Thank you so much for making this great tool available and for your help.
     
    BansheeGz likes this.
  2. mansoor090

    mansoor090

    Joined:
    Feb 18, 2018
    Posts:
    13
    Hey. BG, is there any options to spawn multile objects along bezier curve which is generated and runtime time infinite support?
     
  3. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @mansoor090
    Hey, generating random spline at runtime and spawning objects at random positions along this spline is very easy.
    Simply create a spline, add points, add BGCcMath component to it, instantiate new GameObjects you want to spawn and assign random position along this spline by using this code:
    Code (CSharp):
    1. go.transform.position = math.CalcPositionByDistance(Random.Range(0, math.GetDistance()));
    I attached a working example:
    1) Open up Assets\BansheeGzSupport\support.unity scene
    2) Run it
    3) Switch to Scene view and chose "BGCurve [generated]" GameObject to review the spline


    Sorry, I'm not sure I understood what you mean by "infinite support"
     

    Attached Files:

    Last edited: Jan 15, 2019
    mansoor090 likes this.
  4. ktest112233

    ktest112233

    Joined:
    Jan 7, 2019
    Posts:
    37
    Hi, I am trying to make a 2D GameObject move around a path using the Minimalistic example and can't seem to get the rotation right.

    Code (CSharp):
    1.  
    2.        distance += 5 * Time.deltaTime;
    3.  
    4.        //calculate position and tangent
    5.        Vector3 tangent;
    6.        ObjectToMove.position = GetComponent<BGCcMath>().CalcPositionAndTangentByDistance(distance, out tangent);
    7.        ObjectToMove.rotation = Quaternion.LookRotation(tangent);
    8.  


    The game object X rotation is changing, Y stays 90 and Z is 0. Here Z should be changing as its a 2D object. Would be great if you can help out. Being trying to get it done from 2-3hrs still no luck.
     
  5. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Hi,
    Instead of
    Code (CSharp):
    1. ObjectToMove.rotation = Quaternion.LookRotation(tangent);
    use
    Code (CSharp):
    1. ObjectToMove.rotation = Quaternion.AngleAxis(Mathf.Atan2(tangent.y, tangent.x) * Mathf.Rad2Deg, Vector3.forward);
    We'll update the docs
    I attached a working example (Assets\BansheeGzSupport\support.unity)
    More information: https://answers.unity.com/questions/623617/how-to-use-rotations-in-2d.html
     

    Attached Files:

  6. ktest112233

    ktest112233

    Joined:
    Jan 7, 2019
    Posts:
    37
    Thank you for the quick reply. I was also able to do it by setting the x,y of resultant angle to 0
     
  7. mansoor090

    mansoor090

    Joined:
    Feb 18, 2018
    Posts:
    13

    i will look right after i reach home.
    i actually meant a infinite bezier path. I cant even understand what i meant by infinite support with that context :D
     
  8. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
  9. mansoor090

    mansoor090

    Joined:
    Feb 18, 2018
    Posts:
    13
    i will dig something like this. to create a new point at some distance by script and reset all the scene objects after some position reached . just like i do for endless games, Anyways thanks for your reply :)
     
  10. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @mansoor090

    Here is an example for constructing "infinite" 3D spline. (Assets\BansheeGzSupport\infiniteSpline3D.unity)
    I hope it will help.
     

    Attached Files:

  11. ikryloff

    ikryloff

    Joined:
    Jun 20, 2018
    Posts:
    2
    Hello! I need to make one curve from two or more. How I can make it by C# script? I want to make a method, that make new curve by coping points from other curves. But there is no BGCurve methods, that take as argument Points. Im newby. Thanks!
     
  12. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @ikryloff
    Hello, this is an example of combining 2 splines into 3rd one by copying their points.
    Hope it will be helpful.

    Code (CSharp):
    1. using UnityEngine;
    2. using BansheeGz.BGSpline.Curve;
    3.  
    4. /// <summary>
    5. /// Create a spline by combining points from 2 different splines
    6. /// </summary>
    7. [RequireComponent(typeof(BGCurve))]
    8. public class CombineSplines : MonoBehaviour
    9. {
    10.     public BGCurve curve1;
    11.     public BGCurve curve2;
    12.  
    13.     private BGCurve curve;
    14.     void Start ()
    15.     {
    16.         curve = GetComponent<BGCurve>();
    17.         CopyFrom(curve1);
    18.         CopyFrom(curve2);
    19.     }
    20.  
    21.     private void CopyFrom(BGCurve fromCurve)
    22.     {
    23.         for (var i = 0; i < fromCurve.PointsCount; i++)
    24.         {
    25.             var fromPoint = fromCurve[i];
    26.             curve.AddPoint(new BGCurvePoint(curve, fromPoint.PositionWorld, fromPoint.ControlType, fromPoint.ControlFirstWorld, fromPoint.ControlSecondWorld, true));
    27.         }
    28.     }
    29. }
     
    ikryloff likes this.
  13. ikryloff

    ikryloff

    Joined:
    Jun 20, 2018
    Posts:
    2
    Great! Thank You very much!
     
  14. Tiollo

    Tiollo

    Joined:
    Mar 14, 2015
    Posts:
    23
    Hi there!
    I am trying to add some Cursor components at runtime but I don't know what's the correct way to do it.

    I have tried to do something like this:

    Code (CSharp):
    1. BGCcCursorChangeLinear c1 = gameObject.AddComponent<BGCcCursorChangeLinear>();
    But nothing changes. I think it happens because I need to tell that the new cursor is a child-component of the Math component. But I can't find a way to do it from the documentation.

    I also need each cursor to have the "Cursor Change Linear" and the "Translate Object" components as children, but I have the same problem there.

    Any tip?

    Thanks a lot in advance! :)
     
  15. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Tiollo likes this.
  16. Tiollo

    Tiollo

    Joined:
    Mar 14, 2015
    Posts:
    23
    Awesome, thanks a lot! I totally missed the TRS component :)
     
  17. filizgokce

    filizgokce

    Joined:
    Mar 7, 2018
    Posts:
    4
    Hi,

    First of all, thanks a lot for this amazing asset. It is really great and saved a lot of hard work.

    As for my question;
    I've created a spline for my game objects to move on and used Ping Pong option for overflow control. But as far as I understand, there is no option to rotate the object when cursor overflows spline. As my game objects have a front and back view, they just seem to move backwards when they hit the end of spline. Any solution to fix this issue?

    Thanks in advance.
     
  18. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @filizgokce
    Hi, thank you for your support!


    The technique is to set OffsetAngle to 180 degrees rotation.
    For example to rotate it to 180 degrees around the Y axis you can set it to new Vector3(0,180,0).


    And here is how to find a moment to apply it:
    1) If you use TRS component, you can monitor SpeedIsReversed property
    2) If you use cursor+changeLinear+translate+rotate components, you can use PointReached event (BGCcCursorChangeLinear component).


    I've set up a simple example Assets\BansheeGzSupport\support.unity , please, take a look at Assets\BansheeGzSupport\RotationFixTrs.cs for the 1st option and Assets\BansheeGzSupport\RotationFixCursor.cs for the 2nd one
     

    Attached Files:

    filizgokce likes this.
  19. filizgokce

    filizgokce

    Joined:
    Mar 7, 2018
    Posts:
    4
    @BansheeGz
    Thanks a lot for the solution.

    Although it was fixing the problem for only one TRS component, I easily changed it for multiple TRS use. (See attached.)

    A suggestion: I've been using Delay Field parameter from Cursor Change Linear component. I think it would be better to put that parameter in TRS component as well so that we won't have to add another component just to use delays on objects.

    Another suggestion: In Points tab, Selected points section is really useful but when we have a lot of points it goes down as normal but I guess it is more useful on top. So we can select/deselect all points easier and don't have to scroll all the way down.

    Thanks again. Keep up the great work.
     

    Attached Files:

    BansheeGz likes this.
  20. filizgokce

    filizgokce

    Joined:
    Mar 7, 2018
    Posts:
    4
    @BansheeGz
    Hi again.

    Just another question. :)
    Is there any chance to specify points for Point Reached Event on Cursor Change Linear component?

    For example, I want to enable a part of a gameobject when it's on the first point, and disable it on the last point.
    I could achieve this by adding two events if there was an option to say on which points these events would be triggered.

    Thanks in advance.
     
  21. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Yes, it should work, thank you for sharing

    Thank you for suggestions
    We intentionally did not transfer all features to Trs component, cause we wanted to keep it as simple as possible, so people would not be scared away by simply looking at it.
    Cursor Change Linear component became so complicated over time, so it's almost unmaintainable
    We just did not want to go the same route again with Trs

    You can hide points menu temporarily with "Hide" button (next to Points menu header right above points controls)
    Unfortunately, moving selection controls to the top will not work, cause it will break another feature- selecting points by clicking and dragging over tick icons.

    1) You could use one single event listener, no need to use 2
    2) Point index is passed to the event listener as an argument (PointIndex field in
    BGCcCursorChangeLinear.PointReachedArgs)

    Here is an example from the package I sent you earlier (RotationFixCursor.cs):
    Code (CSharp):
    1.     private void PointReached(object sender, BGCcCursorChangeLinear.PointReachedArgs e)
    2.     {
    3.         if (e.PointIndex == 0) rotate.OffsetAngle = Vector3.zero;
    4.         else if (e.PointIndex == changeLinear.Curve.PointsCount - 1) rotate.OffsetAngle = new Vector3(0, 180, 0);
    5.     }
     
    Last edited: Mar 20, 2019
  22. filizgokce

    filizgokce

    Joined:
    Mar 7, 2018
    Posts:
    4
    That really helped. Thanks a lot again. :)
     
  23. DMariscal

    DMariscal

    Joined:
    Feb 2, 2017
    Posts:
    5
    Hi there,

    I'm really finding your asset super useful, the example sections is a great complement to the API itself, it has already saved me a lot of time for my prototype! I'm trying to serialize a BGCurve component from a game object, but so far is not working well. Here is what I'm doing:

    I have a small class that contains the BGCurve I want to save:

    Code (CSharp):
    1. [System.Serializable]
    2. public class GameData
    3. {
    4.     public BGCurve Line;
    5.  
    6.     public TrackData(BGCurve TestLine)
    7.     {
    8.         Line = TestLine;
    9.     }
    10. }
    And then a code to serialize it, I tried the binary formatter but since it's hard to see the contents I've switched to Json instead:

    Code (CSharp):
    1. public static void SaveCurve(BGCurve line)
    2.     {
    3.         GameDate data = new GameData(line);
    4.         string json = JsonUtility.ToJson(data);
    5.  
    6.         //Binary formatter
    7.         BinaryFormatter formatter = new BinaryFormatter();
    8.         string path = Application.persistentDataPath + "/save.dat";
    9.  
    10.         FileStream stream = new FileStream(path, FileMode.Create);
    11.         formatter.Serialize(stream, data);
    12.         stream.Close();
    13.     }
    Looking at the json variable, this is the value:
    {"Line":{"instanceID":-8112}}

    Do you know how to be able to serialize a BGCurve with all its points and control points? Am I missing something really obvious here? :)

    Once again thanks for the amazing work on this asset, it's making my life so much easier!
     
  24. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @DMariscal
    Hi, thank you for your support!

    BGCurve is just a regular MonoBehaviour script, which is meant to
    1) be attached to GameObject
    2) work with Unity serializer.
    I do not think it can work with any other serializer

    Here is a workaround:
    1) Create your own (serializable) model and move all data from BGCurve to this model before serialization
    2) After deserialization move all data from your model to BGCurve

    I attached a working example, I hope it will help.
    Here is how to test it:
    1) Create an empty scene
    2) Add BGCurve with points
    3) Attach CurveSerializer to it and run the scene once for data to be written to a file.
    4) Disable GameObject with a curve
    5) Add empty BGCurve, attach CurveSerializer and toggle "Load" parameter on.
    6) Run the scene, the copy of original curve should be created.
     

    Attached Files:

  25. DMariscal

    DMariscal

    Joined:
    Feb 2, 2017
    Posts:
    5
    Thank you so much for the quick answer! I'll test this later when I'm at home, but based on a quick read of the code it looks like it will solve my problems. Your support in this forum thread is outstanding!

    Please keep up the hard work with all your tools/assets, they are excellent!
     
    BansheeGz likes this.
  26. OfficialGrimPanda

    OfficialGrimPanda

    Joined:
    Mar 26, 2014
    Posts:
    2
    @BansheeGz This is fantastic work. Very robust tool! Thank you so much for creating and sharing it.

    I just had a couple questions for you:

    1) Is there a fix for the "InvalidCastException: Specified cast is not valid" error from BGCcEditor.OnEnable()? Not sure if it's needed, but I believe this is the code producing it for me:
    (for some reason using the code markup triggers the "this post contains spam" protection, so I'll have to post an image of it:




    2) Is there any plans on providing an editor available offset position fields for TRS components with Move enabled? Similar to the Rotate Offset Angle?
     
    Last edited: May 21, 2019
  27. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @OfficialGrimPanda , hello
    Thank you for your feedback

    Sorry, I was not able to reproduce it.
    I tried running your code with Curve gameobject selected, and I do not see any error.
    If it's possible, please, provide more details about how could I reproduce this error.
    Thank you.

    I attached a patch with additional "Move Offset" parameter for TRS component
     

    Attached Files:

    Last edited: May 21, 2019
  28. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    It looks like TRS component Editor is completely broken with Unity >2017 :(
    It works ok with Unity 5.x

    We will submit a fix soon and we will drop support for Unity 5.x
     
  29. OfficialGrimPanda

    OfficialGrimPanda

    Joined:
    Mar 26, 2014
    Posts:
    2
    @BansheeGz Many thanks for the update. I should have mentioned that previously, but yes, I'm working in Unity 2019.x
     
  30. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    Code (CSharp):
    1.         var Curve = GetComponent<BGCurve>();
    2.         Debug.Log(Curve.Points[0].ControlFirstLocal);
    upload_2019-6-8_23-34-36.png

    Debug shows inaccurate values
     
  31. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    @yaboo

    It works fine for me.

    Code (CSharp):
    1.         var Curve = GetComponent<BGCurve>();
    2.         Debug.Log("Pos (World)=" + Curve.Points[0].PositionWorld);
    3.         Debug.Log("Control 1 (Local)=" + Curve.Points[0].ControlFirstLocal);
    4.         Debug.Log("Control 2 (Local)=" + Curve.Points[0].ControlSecondLocal);


     
  32. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    should be display
    -2.865.23,2.912477,3.06
    not
    -2.9,2.9,3.1
     
  33. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    When you print Vector3 to the console, Vector3.ToString method is called
    This method is defined like this:
    Code (CSharp):
    1.     public override string ToString()
    2.     {
    3.       return UnityString.Format("({0:F1}, {1:F1}, {2:F1})", (object) this.x, (object) this.y, (object) this.z);
    4.     }
    It rounds fields (x,y,z) to one single decimal place, so the result is correct.

    If you need another format you need to use Vector3.ToString(string format) method instead

    For example, to print 3 decimal places, you need to call it like this:

    Code (CSharp):
    1. Debug.Log("Pos (World)=" + Curve.Points[0].PositionWorld.ToString("F3"));
    You can read more about numbers formats here https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
     
  34. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    Aha,:D,Thank you

    Another Error,unity 2018.4.1
    upload_2019-6-9_17-52-58.png
     
  35. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Please, change this line to
    Code (CSharp):
    1. Curve = target as BGCurve;
    we will release a fix soon
     
  36. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    @BansheeGz
    Can you provide a method for run-time insertion point?

    BGCurveEditor.AddPoint
    I try to modify, but without success
     
    Last edited: Jun 12, 2019
  37. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    1) To add a point to the end of the curve, use BGCurve.AddPoint(BGCurvePoint point) method
    2) To add a point at specified index, use BGCurve.AddPoint(BGCurvePoint point, int index) method

    Example:
    Code (CSharp):
    1. using BansheeGz.BGSpline.Curve;
    2. using UnityEngine;
    3.  
    4. [RequireComponent(typeof(BGCurve))]
    5. public class InsertPoints : MonoBehaviour
    6. {
    7.     void Start()
    8.     {
    9.         var сurve = GetComponent<BGCurve>();
    10.  
    11.         //add a point to the end
    12.         сurve.AddPoint(new BGCurvePoint(сurve, Vector3.up, BGCurvePoint.ControlTypeEnum.BezierSymmetrical, Vector3.right, Vector3.left));
    13.  
    14.         //add a point at specified index (=0)
    15.         сurve.AddPoint(new BGCurvePoint(сurve, Vector3.down, BGCurvePoint.ControlTypeEnum.BezierSymmetrical, Vector3.right, Vector3.left), 0);
    16.     }
    17. }
     
  38. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    @BansheeGz Thank you

    How to get the tangent of a point(BGCurvePointI )?
     
  39. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    1) Make sure you added "Math" component to a curve and make sure it calculates tangents (Fields="Position and Tangent")
    2) Calculate distance to the point
    3) Use calculated distance to calculate tangent

    Example:
    Code (CSharp):
    1. using BansheeGz.BGSpline.Components;
    2. using UnityEngine;
    3.  
    4. [RequireComponent(typeof(BGCcMath))]
    5. public class PointTangentCalculator : MonoBehaviour
    6. {
    7.     public int pointIndex;
    8.  
    9.     void Start()
    10.     {
    11.         var math = GetComponent<BGCcMath>();
    12.  
    13.         //calculate the distance to a point
    14.         var distanceToPoint = math.GetDistance(pointIndex);
    15.  
    16.         //calculate point's tangent
    17.         var tangent = math.CalcTangentByDistance(distanceToPoint);
    18.     }
    19. }
     
  40. TheFlyHawk

    TheFlyHawk

    Joined:
    Mar 23, 2016
    Posts:
    58
    @BansheeGz
    Code (CSharp):
    1.         var ccMath = comp.gameObject.AddComponent<BGCcMath>();
    2.         ccMath.Fields = BGCurveBaseMath.Fields.PositionAndTangent;
    3.            ccMath.Curve.ForceChangedEventMode = BGCurve.ForceChangedEventModeEnum.EditorAndRuntime;
    4.             ccMath.Math.SuppressWarning = true;
    5.             var SpeedField = ccMath .Curve.AddField("Speed", BGCurvePointField.TypeEnum.Float);
    6.             var DelayField = ccMath .Curve.AddField("Delay", BGCurvePointField.TypeEnum.Float);
    7.             var RotationField = ccMath .Curve.AddField("Rotation", BGCurvePointField.TypeEnum.Quaternion);
    8.             var ScaleField = ccMath .Curve.AddField("Scale", BGCurvePointField.TypeEnum.Vector3);
    9.  
    10.  
    11.             var distanceToPoint = ccMath .GetDistance(index);
    12.             var tangent = ccMath .CalcTangentByDistance(distanceToPoint);
    13.  
    14.             var leftPoint = GameObject.CreatePrimitive(PrimitiveType.Sphere).transform;
    15.             leftPoint.localScale = Vector3.one * 0.2f;
    16.             leftPoint.name = index + "Left";
    17.             leftPoint.position = pointData.PositionWorld - tangent;
    18.             pointData.ControlFirstLocal = -tangent;
    19.  
    20.             var rightPoint = GameObject.CreatePrimitive(PrimitiveType.Sphere).transform;
    21.             rightPoint.localScale = Vector3.one * 0.2f;
    22.             rightPoint.name = index + "Right";
    23.             rightPoint.position = pointData.PositionWorld + tangent;
    24.             pointData.ControlSecondLocal = tangent;
    There are plenty of warnings.

    BGCurve[BGCurveBaseMath] Warning! We noticed you are updating math more than once per frame. This is not optimal. If you use curve.ImmediateChangeEvents by some reason, try to use curve.Transaction to wrap all the changes to one single event.. You can suppress all warnings by using BGCurveBaseMath.SuppressWarning=true;
    UnityEngine.Debug:Log(Object)
    BansheeGz.BGSpline.Curve.BGCurveBaseMath:Warning(String, Boolean, Action) (at Assets/BansheeGz/BGCurve/Scripts/Curve/BGCurveBaseMath.cs:658)
    BansheeGz.BGSpline.Curve.BGCurveBaseMath:Recalculate(Boolean) (at Assets/BansheeGz/BGCurve/Scripts/Curve/BGCurveBaseMath.cs:592)
    BansheeGz.BGSpline.Editor.BGCurveEditor:OnSceneGUI() (at Assets/BansheeGz/BGCurve/Scripts/Editor/Curve/BGCurveEditor.cs:396)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
     
  41. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Please, remove this line
    Code (CSharp):
    1. ccMath.Curve.ForceChangedEventMode = BGCurve.ForceChangedEventModeEnum.EditorAndRuntime;
    This mode is used only if curve is being changed externally at runtime (for example with Unity animator)
     
  42. mrose1977

    mrose1977

    Joined:
    May 21, 2018
    Posts:
    1
    I need a version compatible with Unity 5 for work. Will there be an archive download available?
     
  43. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Current version probably still working with Unity 5.x fine, cause we did not remove legacy code, we just stopped testing and supporting it and there was not too much changes.
    The archive is available here https://github.com/bansheeGz/BGCurve/tree/master/Package
     
  44. brandonschlosser101

    brandonschlosser101

    Joined:
    Apr 19, 2018
    Posts:
    15
    Hi there! I'm still fairly new to coding and need some help with using your curves. In essence I have a side scroller platformer where while holding one key goes right and another goes left. I want to use this to add a more complex path than just staying on the x axis. As of now I have a turn set up but the player that is attached to it moves on loop as if it is an animation. How can I specify to only move one way when pressing my "move right" key and the other way when pressing the "move left" key? My character also has the ability to jump, so could that work using this if I wanted the player to jump while traversing the curve?

    I'm sure this is a basic question but any help for a noob would be greatly appreciated!

    Thank you!
     
  45. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Hi!

    So you want to have spline-shaped ground and you want your character to move and jump on top of that ground, correct?
    Do you consider the opportunity of using 2D physics for this task?
    I think it would be much easier to implement using 2D physics
    To create spline-shaped ground, you could use Unity's SpriteShape package
     
    Last edited: Jul 9, 2019
  46. mediapod_uk

    mediapod_uk

    Joined:
    Jun 4, 2019
    Posts:
    6
    Hi, Lovely asset pack - thank you!
    I'm trying to get it to work for drawing road lines and markings using the line renderer but I can't get it to face upwards. Using Unity's normal line renderer you can just set it's alignment to Transform Z and Y rotation to 90 and it faces upwards. But can't do this with BGCurve as it rotates the whole object.
     
  47. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Hi!
    Try to rotate GameObject before adding points
    GameObject's transform (position/rotation/scale) affects points positions
     
  48. mix773

    mix773

    Joined:
    Oct 7, 2014
    Posts:
    3
    Hi,

    I try to use your BGCurve class with Sweep2D class to extrude 2d-spline XY profile along the road path. But I can expand the generated path only in XZ direction, not able to vary Y coordinate - sweeped2d/BGcurve classes applied this restriction. Is it possible in your package to generate 2d spline over all coordinates XYZ? May be I have not revealed this feature in your examples or in class methods? Thank you in advance.
     
  49. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    366
    Hi,
    Unfortunately, this is not the only restriction: the other one- is that generated polygons may overlap at steep angles.
    We have both limitations described on this page: http://www.bansheegz.com/BGCurve/Cc/BGCcSweep2D/
     
  50. whitesilverrr

    whitesilverrr

    Joined:
    Oct 11, 2019
    Posts:
    4
    Hello, is it possible to constraint my rigidbodies position and rotations to the spline while maintaining their gravity?
    I'm trying to make path constrained characters and objects, but the translate component isn't what I was looking for.