- Home /
Question by
douglasg14b · May 04, 2015 at 12:46 AM ·
meshruntime
My runtime mesh is being created to the far right of my unit?
I'm creating a mesh at runtime ans this is what ends up happening:
The squares to the right correspond to the ships to the left. The white dots around the outside of those ships are dots drawn where the vertices of the mesh are, which is why I'm so confused. The vertices of the mesh seem perfectly fine, but it's way over to the side.
My Code:
//Creates a bounding mesh for the unit
private Mesh CreateBoundingMesh(BoundingPointsType boundingPoints)
{
Mesh boundingMesh = new Mesh();
boundingMesh.name = "Bounding Quad";
Vector3[] vertices = new Vector3[4]
{
boundingPoints.LowerLeftPoint,
boundingPoints.LowerRightPoint,
boundingPoints.UpperRightPoint,
boundingPoints.UpperLeftPoint
};
int[] triangles = new int[6]
{
0,
2,
1,
0,
3,
2
};
boundingMesh.vertices = vertices;
boundingMesh.triangles = triangles;
return boundingMesh;
}
Edit: Tried just creating a square around the units transform.position. By adding + and - 1 to the coordinates from it's transform.position and it is still offset to the far right. I'm pretty confused as to what's going wrong now.
Comment
Impossible to say without knowing how the boundingPoints.LowerLeftPoint etc. are assigned.
Your answer
![](https://koobas.hobune.stream/wayback/20220613194710im_/https://answers.unity.com/themes/thub/images/avi.jpg)