2
나는 어디에서나 답을 찾을 수 없었고 가능한지 의심 스럽다. LIbgdx "Invisble"에 몸을 어떻게 보관할 수 있습니까? 그래서 모든 것과 상호 작용하고 규칙적인 몸처럼 행동하지만 단지 렌더링되지 않습니다.Libgdx Box2d에서 바디를 렌더링되지 않은 상태로 유지하려면 어떻게해야합니까?
나는 어디에서나 답을 찾을 수 없었고 가능한지 의심 스럽다. LIbgdx "Invisble"에 몸을 어떻게 보관할 수 있습니까? 그래서 모든 것과 상호 작용하고 규칙적인 몸처럼 행동하지만 단지 렌더링되지 않습니다.Libgdx Box2d에서 바디를 렌더링되지 않은 상태로 유지하려면 어떻게해야합니까?
Box2dDebugRenderer을 직접 생성하고 renderBody
메서드를 재정의 할 수 있습니다.
class MyBox2dRenderer extends Box2DDebugRenderer {
private ArrayList<Body> notRenderingBodies; // array of vodies that you dont want to render
public MyBox2dRenderer(ArrayList<Body> notRenderingBodies) {
super();
this.notRenderingBodies = notRenderingBodies;
}
@Override
protected void renderBody(Body body) {
for (Body b : notRenderingBodies) { // loop through all bodies in array
if (b == body){ // if given body equals by reference to one from list than return
return;
}
}
super.renderBody(body);
}
public ArrayList<Body> getNotDenderingBodies() {
return notRenderingBodies;
}
public void setNotDenderingBodies(ArrayList<Body> notDenderingBodies) {
this.notRenderingBodies = notDenderingBodies;
}
}
정말 고맙습니다. – ronsap123