2017-04-06 130 views
0

我創造了這樣一個矩形多邊形:多邊形渲染,LibGdx

polyrect=new Polygon(new float[]{0,0,width,0,width,height,0,height}); 
polyrect.setOrigin(width,0); 
polyrect.setRotation(45f); 
polyrect.setPosition(getX(),getY()); 
shapeRenderer.polygon(polySwatter.getTransformedVertices()); 

它運作良好,但現在我要畫一個倒三角這個樣子。

enter image description here

怎樣繪製用這種方法倒三角?

+1

你是什麼意思由倒三角形? – Aryan

+0

添加了圖片@ AbhishekAryan – Niranjana

回答

1

您可以用這種方式設置頂點,這可以給您倒三角形。

polyrect=new Polygon(new float[]{width/2f,0,width,height,0,height}); 
polyrect.setOrigin(width,0); 
//polyrect.setRotation(45f); 
polyrect.setPosition(200,200); 
+0

它工作!謝謝! – Niranjana