Question by
Nitroglycerin_ · Sep 02, 2017 at 01:19 AM ·
c#
How to make a mesh from 4 points?
I would like to have a script to build a plane with 4 points at the moment I have a script that can get the position of all the points but I don't know how to create the plane is it possible?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ClothBuild : MonoBehaviour{
public GameObject p1;
public GameObject p2;
public GameObject p3;
public GameObject p4;
public Vector3 pos1;
public Vector3 pos2;
public Vector3 pos3;
public Vector3 pos4;
void Start()
{
//finds spheres
p1 = GameObject.Find("P1");
p2 = GameObject.Find("P2");
p3 = GameObject.Find("P3");
p4 = GameObject.Find("P4");
//gets the positions of all spheres
pos1 = p1.transform.position;
pos2 = p2.transform.position;
pos3 = p3.transform.position;
pos4 = p4.transform.position;
}
Comment
Best Answer
Answer by Nitroglycerin_ · Sep 23, 2018 at 08:19 AM
For anyone looking this up in the future following this really helped