GithubHelp home page GithubHelp logo

bgcurve's People

Contributors

banshee-gzzz avatar bomberest avatar kamyker avatar panicdealer avatar passivepicasso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bgcurve's Issues

point distance

Hello,
How can we calculate the distance for a given point?

did i miss something in the docs?

http://www.bansheegz.com/BGCurve/DeveloperGuide/Math/

Position and distance(optionally) for a point, which is on the spline and closest to some other point, which is not on the spline (math.CalcPositionByClosestPoint(Vector3 point))

BGCurve line render component osx / ios issue

Hi!
I've been using BG curve for a new project & overall I must say it is great :).
However, I've found an issue with the line render component on osx/ios. I have created a path, constricted to xz, a road basically. On Windows/Android the vertices faces up, which seems correct. On OSX and when built for IOS the vertices faces right. I can counter this by rotating the entire GameObject around z on osx, but of course all the control-points get the wrong orientation then. This issue is not present when I replicate the road with the Unity line renderer only. So there seems to be some transformation issue somewhere.

Incompatibility with Unity 2019.3.13f1+

Hi, when I try to create a BGCurve using Unity 2019.3.13f1 or Unity 2019.4.0f1, it doesn't display any of the point selection UI, or the overlay when holding ctrl. It works when I use 2019.1.8f1, so this might be related to the Unity UI refresh that happened as part of 2019.3?

Test Steps:

  1. Install Unity 2019.3.13f1 or 2019.4.0.f1 using Unity Hub
  2. Create a new project using Unity Hub.
  3. Window > Asset Store > Import BGCurve.
  4. In Hierarchy window: Right Click > Create Other > BansheeGZ > BG Curve.

Ctrl clicking / ctrl shift clicking doesn't work. Manually adding points in the inspector doesn't show them.

Here's a screenshot showing side-by-side unity 2019.1 and 2019.4 with identical scenes & points.

BGCurveIncompatibility

Thanks!

Attached points as parent-child relation

I have 3 different points which generated a curve. I want that when I change position of points[1], also points [2] would be changed as children object(angles & positions). I tried to find settings or properties about this but I couldn't find. Is there any option about it?

Large distance between points and delay bug?

Hi,

Currently I am trying to use BGCurve to make an animation. All is going well, except I have one issue where the cursor gets stuck. Maybe it's a precision issue, I don't know.

So I have been trying to figure out if something is a bug or not, and I think it is. I am currently using 1.2.2, but also just installed 1.2.3 Beta as a test. The problem still persists.

The problem is that the Lerp component gets "stuck" on a point when there are delays and large distances involved.

A quick test case:

  • Create an BGCurve that moves an object around (So, component: Math, Cursor, Cursor Change Linear and Translate object by cursor).
  • Add a custom field called "delay" (type: float)
  • Specify that this "delay" field is used as a delay field in "Cursor Change Linear".
  • Overflow control: stop.
  • Speed 5

Add 4 points as below, type "Absent". I normally use symmetric independent, but for the example it does not matter.
x y z
-16.50 0 0
-97.70 0 -12.00
20.00 0 0
11.00 0 10.90

Give point 2 and 3 a delay of 5 seconds.

Run! :-) - The object will correctly manage to get to the last point (index: 3)

Now Stop the Unity project.

Now multiply all values with 100:

x y z
-1650 0 0
-9770 0 -1200
2000 0 0
1100 0 1090
Speed also 500 (but the value does not matter, lower is fine too if you have more patience)

Run again.
Now the object will get stuck after point 2 and jump back and forth a tiny bit. Removing the delay while running will immediately make it continue again.

Any ideas what can cause this problem? I suppose it's a precision issue maybe, but I have been unable to pinpoint the exact location of this issue.

Cursor won't move after spawn 2 or more cursor by script.

Hi BG,

I want to add cursor to math using script. The problem is if I added 2 or more cursor the cursor won't move, and it freeze at the starting point of the curve even I try to assign it position via DistanceRation.
What I have to do to make it work?. Thanks.

PS. Your asset is great!

My code.

// Use this for initialization
	void Start () {
        for (int i = 0; i < arrow; i++)
        {
            BGCcCursor cur = gameObject.AddComponent<BGCcCursor>();
            GameObject obj = Instantiate(movingObject, gameObject.transform.position, Quaternion.identity, gameObject.transform);
            BGCcCursorObjectTranslate objTran = gameObject.AddComponent<BGCcCursorObjectTranslate>();
            objTran.SetParent(cur);
            objTran.ObjectToManipulate = obj.transform;
            BGCcCursorObjectRotate objRot = gameObject.AddComponent<BGCcCursorObjectRotate>();
            objRot.SetParent(cur);
            objRot.ObjectToManipulate = obj.transform;
            objRot.OffsetAngle = new Vector3(0, -90, 0);
        }
        c = GameObject.Find("BGCurve").GetComponents<BGCcCursor>();
        Debug.Log(c.Length);
        for (int i = 0; i < c.Length; i++)
        {
            c[i].DistanceRatio = (0 + (1f / arrow) * i);
        }
    }
	
	// Update is called once per frame
	void Update () {
        if (level < 0) level = 0;
        if (level > 4) level = 4;

        for (int i = 0; i < c.Length; i++)
        {
            c[i].DistanceRatio += (float)(baseSpeed + (increament * level));
        }
        if (c[0].DistanceRatio >= 1/arrow)
        {
            for (int i = 0; i < c.Length; i++)
            {
                c[i].DistanceRatio = 0 + (1 / arrow) * i;
            }
        }
    }

Get the interpolated value of a field at any position on the curve

I'm using BGCurve to make objects travel along a path. I added a custom field called rotation to my curve to define the desired rotation of each object at each point of the curve. I would like to be able to get the rotation value at any given position on the curve, even in between points.

Obviously this can't be done with all custom fields since not all field types are quantitative but at least it would be nice if this feature was available for those field types that can be interpolated (floats, vectors, etc).

I guess a prerequisite for this is the ability to get a point from a position on the curve (e.g. GetNearestPointsByDistance()). If developers could access points by their distance along the curve, or by their position in space, they could then access the custom fields associated with those points and interpolate them - or do whatever else they want. The math classes already do this by running binary search on the points.

Manipulate multiple objects

Hello.
I've created math with cursor, translate, ccl. If I wouldn't set translate object directly there will be an error(not critical). But I have attached object by code. I think that is a bug.

Spawn GameObject along point of curve?

Hi BG!

So I am using your asset (great job!) and I think it would be a good improvement to allow instantiating gameobjects along the curve. I want to try implement this, but am not sure where to start. Can you please point me in the right direction?

I would think it would be broken into 2 parts;

  1. Add a new Green Component field, something like Spawn Gameobject Along Curve, with a field for the gameobject, and a minimum distance to find the nearest point to spawn it on. If its further than this, create its own point to spawn from.

  2. With Ctrl held along spline point, Right Click to spawn at nearest point.

If this sounds reasonable, please let me know where I should start!
Thank you!

Missing type or namespace errors on build

Hello,

When attempting to build my project, I get about 150 missing type or namespace errors. Here is a screenshot:
Capture

I'm just using what was uploaded to Unity Asset store and I'm on Unity version 2020.3.13f1. Do you have any idea what may be causing this? Thanks.

Trigger Cursor Movement

Hi there! Thanks for these little master piece, the asset is pretty powerful!

I'm actually going through the examples and the API / documentation. I'm wondering if it is already possible to trigger the cursor interpolation by script / UnityEvents? All the examples start with the animations right from the 1 frame.

Dragging an object attached to a cursor

Hi, I'm trying to implement mouse dragging of an object along spline.
For simple splines I could use Math.getPositionByClosestPoint, but that wouldn't work for spline crossing itself or for spiral cases.
My idea was to simply move cursor by a distance using a dot product between cursor's tangent and a vector from cursor to mouse position:

private void HandleDragging() {
	Vector3 cursorPosition;
	Vector3 tangent;
	cursorPosition = cursor.Math.CalcPositionAndTangentByDistance(cursor.Distance, out tangent);
	Vector3 mousePositionWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
	mousePositionWorld.z = 0.0f; // It's 2D, so I don't care about Z axis
	cursorPosition.z = 0.0f;
	float dot = Vector3.Dot(tangent, mousePositionWorld - cursorPosition);
	float distanceDelta = Time.deltaTime * Mathf.Min(dot * speedMultiplier, maxSpeed);
	cursor.Distance += distanceDelta;
}

That works quite well, but it has quite serious flaw - when your spline has an arc and you drag quite far away from the convex side of the arc then your dragged object will start to jump around the point where it should be actually projected. This is caused by the fact that when mouse position is far away from cursor then small changes in the tangent along spline results in big distances when projecting with dot product.
I've tried to fix it by reducing the magnitude of vector from cursor to mouse position and it works, but it introduces visible slow-down in cursor movement when dragging fast.
I can see several solutions:

  1. Manualy calculate closest point on the spline by doing multiple iterations which moves closer and closer to the minimum distance (I assume that one could affect performance).
  2. Additional parameter for Math.getPositionByClosestPoint that could limit a range on which it searches for the closest point
  3. Additional function for Cursor to handle such dragging.

Could you help me out?
Maybe I missed out something in the current API and that could be implemented easier?
Maybe the approach could be changed to implement it with current API?
Or maybe you would find it worth to provide my suggestions from points 2 or 3 in next release?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.