(Mathf.Max (L2.StartPoint.x, L2.EndPoint.x) >= Mathf.Min (L1.StartPoint.x, L1.EndPoint.x)) & Following method checks is currentLine(line drawn by last two points) collided with lineįor (int i=0 i= Mathf.Min (L2.StartPoint.x, L2.EndPoint.x)) & Line.SetPosition (pointsList.Count - 1, (Vector3)pointsList ) Drawing line when mouse is moving(presses) PointsList.RemoveRange (0, pointsList.Count) If mouse button down, remove old line and set its color to green Line.material = new Material (Shader.Find ("Particles/Additive")) Create line renderer component and set its property This collision Detection can be achieved by using this given script. Here we are trying to Detect Collision if a line intersects with itself at any point of time while drawing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |