I have a line being drawn on screen, then I add a box collider to this line. If the line drawn is too small, it says the vertices are too small and close together and do not generate a collider, then other objects pass right through it. I currently have the line’s rigidbody to interpolate and isKinematic.
Know of any ways to override this and generate a collider anyways, or make it more efficient?
The line is being drawn by a user’s touch on screen.
You can maybe scale your whole scene so that everything looks the same, but to unity you now have a bigger collider.
Or maybe you can instead use a regular box collider and just make it really flat.
I tried to use EdgeCollider2D, but when the user draws lines, the edge colliders added just stop being added to the line after a certain length. If a user draws a medium/long line, only a few colliders are being created at run time that cover about half of the line.
My scene is scaled proportionally. Any larger or smaller and the graphics become distorted.
I do not know how to do so. I tried drawing a raycast/linecast along the users touch to match the line renderer being drawn, but wasn’t able to complete that, either.
In your line drawing method, are you able to get the lines current length? If so, do a check if the line length is less than a certain amount, just make the line equal to that certain amount.
To get its length, when you are setting the lines positions do a vector3.distance check and if the distance is to small, add to the second distance the amount you need to add in the direction the line was going.
Then how are you creating the line? I assume you are feeding it vector3s? If so, grab those vector3s before doing SetPosition on the linerenderer and check the distance.