

Vector3 midPoint = (startPos + endPos) / 2 Ĭol.transform.position = midPoint // setting position of collider object Enjoy Music © by the band This Will Destroy You Recommended viewing: Large screen, good. Line, Y is width of line, Z will be set as per requirement This Will Destroy You: A Line Rider Feature Film. Following method adds collider to created lineīoxCollider2D col = new GameObject("Collider").AddComponent() Ĭol.transform.parent = ansform // Collider is added as child object of lineįloat lineLength = Vector3.Distance(startPos, endPos) // length of lineĬol.size = new Vector3(lineLength, 0.25f, 1f) // size of collider is set where X is length of Line Rider Artists Discord Application Form: Bens Patreon: Bens YouTube: Bens Portfolio: Bens Twitter: This Will Destroy You: Support Setting the Record. Line = new GameObject("Line").AddComponent() Following method creates line runtime using Line Renderer component GetLine() // On mouse down new line will be created Public Vector3 endPos // End position of line Public Vector3 startPos // Start position of line


Private LineRenderer line // Reference to LineRenderer In the Ball script I can get the Log to print Hit when the Ball hits the collider. I've tried making a loop and setting the vector points back to zero.Įvery time I add a OnCollisonEnter2D I cannot get the Line to register that it hit a ball. It creates a line renderer with two points, adds a Box collider. Many of yall are in the credits as inspirations, so check those out for sure. I would like to destroy the current line when a ball collides or another line is drawn. Enjoy Music © by the band This Will Destroy YouRecommended viewing: Large screen, good audio. So I only want one line on screen at a time.
