I am making a simple game in which i have a ball and an arc revolving around the center. When user touches the screen the ball moves in the direction of pointer and hits the arc. But i am not able to find any method to detect that collision An image has been attached for better understanding
Game image
Debug Snapshot..
I have a circle bound around my ball... What i am doing is
Detecting the point of intersection of ball center and circle on which arc is >revolving. But i am not able to detect whether the arc was there when ball intersected the circle?? please help...:'(
Code for making arc:
public void arc (float x, float y, float radius, float start, float degrees,int segments) {
// int segments = (int)(6 * (float)Math.cbrt(radius) * (degrees / 360.0f));
if (segments <= 0) throw new IllegalArgumentException("segments must be > 0.");
float colorBits = color.toFloatBits();
float theta = (2 * MathUtils.PI * (degrees / 360.0f)) / segments;
float cos = MathUtils.cos(theta);
float sin = MathUtils.sin(theta);
float cx = radius * MathUtils.cos(start * MathUtils.degreesToRadians);
float cy = radius * MathUtils.sin(start * MathUtils.degreesToRadians);
for (int i = 0; i < segments; i++) {
renderer.color(colorBits);
Gdx.gl20.glLineWidth(10);
Gdx.gl.glEnable(GL20.GL_BLEND);
renderer.vertex(x + cx, y + cy, 0);
float temp = cx;
cx = cos * cx - sin * cy;
cy = sin * temp + cos * cy;
renderer.color(colorBits);
renderer.vertex(x + cx, y + cy, 0);
}
}