Volunteer ModeratorModerator

Yeah, bummer. I can watch the points while the game is running and there's no movement. Hmm.

Click to expand...

There kind of has to be, if the texture is changing. Probably the perspective changes involved in moving the camera changes the screen space length of the lines. (Since the texture scale calculations are based on screen space.)

Yes, okay I see what you mean. If you're calculating it based on screen space (and I guess I read that at some point) then it makes sense. I guess it's not exactly made for a situation with this much ambient camera motion

I've got an issue where I'm drawing two separate lines, but using instances of the same material, and are having Vector.SetTextureScale(line, 1f); called. This call is causing the first line to lose it's texture scale information and become stretched again.

Can i attach this 3D line as term of vector to my car body . The dimension and direction of this line should change as my car is moving in particular direction. Is that possible ?.
I have physics formulas and i want to attach lines to the center of gravity of the car. Those lines are velocity and acceleration components.

Hello again, Eric, I've got question about adding colliders to vector lines. I'm attempting to build an erase tool by finding all vector objects in range of my cursor using a sphere collider on the cursor and then iterating the line arrays of all hit vector lines but I'm not sure how to add colliders to the lines. Can I do this at runtime? Should I add box colliders or mesh colliders? To the vector line or vector object?

Volunteer ModeratorModerator

I'm not sure adding colliders would be the best way. I'd suggesting iterating through all the points and checking the distance. (Using the (a-b).sqrMagnitude technique would be a little faster than Distance, which is the same as (a-b).magnitude and uses a square root.) Unless you have a really huge number of points, the performance should be OK. If not, there are other techniques for optimization that would be better than adding tons of colliders.

I'm not sure adding colliders would be the best way. I'd suggesting iterating through all the points and checking the distance. (Using the (a-b).sqrMagnitude technique would be a little faster than Distance, which is the same as (a-b).magnitude and uses a square root.) Unless you have a really huge number of points, the performance should be OK. If not, there are other techniques for optimization that would be better than adding tons of colliders.

--Eric

Click to expand...

really?

I was thinking of using them as triggers adding them to a list then iterating through those in the list...

I'm working on a drawing application so there could be lots of points, but I can't really know until I get some user tests done. Any clue on other optimization techniques?

VectorLine.vectorObject is a reference to the game object used for the line, or do you mean something else?

--Eric

Click to expand...

I am returning a list of all game objects that have Vector in their name, I then want to get all the vector lines from these game objects so I can return the point arrays, but I'm not sure it's possible.

This would be instead of keeping track of all vector lines at the time of their creation.

Hello all, just getting a handle of Vectrosity, and I'm trying to solve a little issue.

I've been playing with various shaders to try and solve this.

The image on the left is from Vectrosity "in game". It's a slightly modified version of the demo "GlowBig" texture with the Particles/Additive (Soft) shader (again, same one from the demo).

The image to the right is more or less what I'm going for.

I don't care about being exactly right, but my question is, is there any way to get rid of the places where the texture is overlapping itself and generating hard angle bright spots?

To provide some more context, this is a line that will be following a player's finger, so "sharp turns" are possible. I was able to make the issue a little better by making sure the points were never closer than 10 or so, but it's still happening.

I'm aware there might not be a solution here, but I'd appreciate any advice (maybe something with a shader? although this is destined for iOS and Android).

EDIT: I tried the various settings for Joins as well, Weld seems to work the best, but it still happens.

Volunteer ModeratorModerator

I'm getting quite interested in Vectrosity (which looks awesome, by the way). I would like to take a look at the documentation and API reference before buying, but couldn't find it anywhere on your site. Could you post a link to it?

Volunteer ModeratorModerator

just to note seems that all these extra lines are pointing from where I'm erasing to vector.zero

Click to expand...

Sounds like you should be erasing in pairs. For example, if you have points [1, 2, 3, 4], and you "erase" point 4 (set it to Vector2.zero), then it will draw points 1-2, and 3-4, except point 4 is zero, so it's drawing from wherever point 3 is to zero. So you should erase both 3 and 4. Which is also why it should be a discrete line...with a continuous line, if you have [1, 2, 3, 4] and set points 2 and 3 to 0, then it would draw from point 1 to zero, and then zero to point 4.

I wanted to say I'm blown away by your level of support in responding to every single one of my posts... thanks so much.

I wanted to pick your brain on those optimizations methods you mentioned before as I did some user testing of my app today, and every tester encountered an issue with the eraser slowing down to a crawl and going below 1fps after drawing for some time.

I'm pretty sure it has to do with the point arrays being created as 500 vector 3s and then filled in as needed, leaving a giant amount of vector3.zero points that are being iterated through. 100 lines becomes 50,000 points to iterate through.

Is there an easy way to chop off this extra part of the line after it's created?

Volunteer ModeratorModerator

Perhaps some variables that keep track of the maximum point in array, and stop checking after that point. So if you have an array of 500 points, and only the first 100 have any real data, then it would stop checking after point 100.

I have a rigidbody that is moving and has forces applied against it for movement but also when it gets close to other objects. I'm trying to draw a prediction curve to show the path the object would take at its current trajectory. If it weren't being acted on by other forces too this would be easier but I'm not sure how to predict how these other objects will act on it.

Maybe not so much of a vectrocity question as me looking for a suggestion to predict this.

Volunteer ModeratorModerator

As it happens I did a routine for someone where it drew a slingshot prediction line, and the only thing I could figure was to calculate the physics on my own. Fortunately physics are pretty much physics, so my code matched up with the built-in physics. However that was just a plain trajectory (with gravity) for one object, so adding more objects would naturally complicate things.

Now you can do uniform texture scaling for the lines, which makes it easy to do things like dotted or dashed lines:

You can set the scale as desired, with 1.0 being normal width, so .5 is half width, 2.0 is double, etc. I updated the curve-making demo (here) with the option of having dotted lines, which seems oddly fun to play around with.... (i.e., try adding a few points and then drag the first anchor point around when dotted lines are turned on.)

--Eric

Click to expand...

Hi, I'm totally new to Unity and Vectrosity. Can you help me solve some problem?
I want to make a dashed line in my project. But it didn't work even if I paste the "Selection box example" code in Vectrosity webside. It is just a "solid line" selection box. I think the code :Vector.SetTextureScale (selectionLine, textureScale, -Time.time*2.0 % 1);
make it become dashed, right? It work in the website, but doesn't work in my unity project. Why??

By the way, is there a formal and complete Vectrosity document or tutorial? I really need it.

I bought Vectrosity. Am trying to apk tankzone to my HTC android. Thought this would be a good setup to do.
The build process gives errors with the single letter variables in the for loops, i.e.:
Assets/Scripts/AvoidObstacle.js(117,22): BCE0005: Unknown identifier: 't'.
Assets/Scripts/PlayerRadar.js(62,14): BCE0005: Unknown identifier: 'i'.
Assets/Scripts/PlayerRadar.js(72,40): BCE0017: The best overload for the method 'System.Collections.Generic.List.<UnityEngine.Transform>.get_Item(int)' is not compatible with the argument list '(error)'.

I started a new project, imported vectrosity, then copied the tankzone game in.

I read the instructions and it works on the pc. Any ideas?

Btw: I used to repair video games and so played alot of hours! Read this as [For free!] Your version is so incredibly close I feel I am back in time, totally consumed. I would like to put the [Tune] in at 100k points(Snagged it from MAME).
When I repaired machines I knew where all the Battle zone and Defender machines were in town. After all I had the keys. Just living the fantasy...
When I would go to the places where the younger teens would hang out I would rack up a few clicks and tell the kid next to me to [Test this].

Volunteer ModeratorModerator

As mentioned in the docs (tips/troubleshooting), the TankZone project won't work on mobile. As it happens, I was just playing it now (for testing purposes )...got to 88K.

@redmacmanz: nearly parallel lines will cause the intersection point to extend quite far. I'll probably have to put a check in that disables the weld for that segment if the intersection point is too far. It's not really possible to smooth it, unless I used more than 4 vertices per segment, but that would complicate and slow things down a fair bit.

Thanks for providing such a great line solution! I'm having a small issue, and thought you might be able to help out. I'm recording input, and playing it back via a continuous line. I've got my playback mechanism working nicely, as I can see the points being plotted when I use points and the DrawPoints method. However, as I go through drawing my line, I'll get these 'flickers' of line that shoot way out of view (thousands of units off screen), but I've confirmed none of the data I'm giving DrawLine3D is that far out of range via this:

Thanks for providing such a great line solution! I'm having a small issue, and thought you might be able to help out. I'm recording input, and playing it back via a continuous line. I've got my playback mechanism working nicely, as I can see the points being plotted when I use points and the DrawPoints method. However, as I go through drawing my line, I'll get these 'flickers' of line that shoot way out of view (thousands of units off screen), but I've confirmed none of the data I'm giving DrawLine3D is that far out of range via this: