Hello, I am doing distance measurement application, when I click on the screen, I get the distance value between the points but I want to calculate the area between these points, how can I do the area calculation
my code is here:
Points.Add(andyObject);
if (Points.Count >= 2)
{
andyObject.GetComponent().positionCount = 2;
andyObject.GetComponent().SetPosition(0, andyObject.transform.position);
andyObject.GetComponent().SetPosition(1, Points[Points.Count - 2].transform.position);
var temp = Instantiate(Text, (andyObject.transform.position + Points[Points.Count - 2].transform.position) / 2, Quaternion.identity);
temp.transform.LookAt(andyObject.transform.position);
temp.transform.localEulerAngles = new Vector3(90, temp.transform.localEulerAngles.y + 90, 0);
temp.GetComponent().text = (Vector3.Distance(andyObject.transform.position, Points[Points.Count - 2].transform.position) * 100).ToString("0.00");
}
↧