#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# How to do collision detection for rotating objects?

edited May 2014

In my program, I need it for rotating triangles colliding with points, but any example code would help. I'm to lazy to experiment and find out how to do this myself (this forum has spoiled me).

• There is nothing special about rotating objects, you still test each line of one triangle to see if the lines of the other triangle intersect it. The only special case is when one triangle is completely inside the other.

Note, I am assuming you are not using the rotate() function, that would not help the collision detection

• edited May 2014

@asimes I am using the rotate() function! I guess that's why I'm stuck. So how can I rotate stuff without that function?

Using trig, here is a link to a Processing tutorial and a quick sketch: http://www.processing.org/tutorials/trig/

``````float radius = 100;
float theta = 0.0;
PVector p;

void setup() {
size(400, 400);
p = new PVector(width/2, height/2);
}

void draw() {
background(255);
beginShape();
float angle = theta;
for (int i = 0; i < 3; i++) {