### Author Topic: Collisions Question  (Read 2908 times)

#### Kyo

• Dr. Type
• Posts: 350
##### Collisions Question
« on: 2014-Sep-23 »
Hi Guys!
I want to give you a few questions on collisions!

there is a function to calculate the collision between two triangles??

there is a function to calculate the collision between two rotated rectangles?

and if I want to use the shape collisions?

Thanks for help!

#### Moru

• Prof. Inline
• Posts: 1774
##### Re: Collisions Question
« Reply #1 on: 2014-Sep-23 »

Long(er) answer: Depends on what you want to do :-)

You could draw the objects on a sprite and then do pixel perfect collision detection on the sprites.

#### Kyo

• Dr. Type
• Posts: 350
##### Re: Collisions Question
« Reply #2 on: 2014-Sep-23 »

Long(er) answer: Depends on what you want to do :-)

You could draw the objects on a sprite and then do pixel perfect collision detection on the sprites.

I don't want to use the pixel perfect collision because it's slow on big images!
The best way is definitely the shape collisions, so if anyone can help me with the code I would be grateful

#### Moru

• Prof. Inline
• Posts: 1774
##### Re: Collisions Question
« Reply #3 on: 2014-Sep-23 »

#### mentalthink

• Prof. Inline
• Posts: 3366
• Integrated Brain
##### Re: Collisions Question
« Reply #4 on: 2014-Sep-23 »
Hi Kyo in my game I use circles and box collision(without rotating), because you can do any collision with this 2 shapes or aproximate to any shape.

I did an Collision Editor and if I want an especific collision I paint them.

If you need more help about this comment me, I think I have the code well ordened and not problem to give you.

#### Kyo

• Dr. Type
• Posts: 350
##### Re: Collisions Question
« Reply #5 on: 2014-Sep-23 »
Hi Kyo in my game I use circles and box collision(without rotating), because you can do any collision with this 2 shapes or aproximate to any shape.

I did an Collision Editor and if I want an especific collision I paint them.

If you need more help about this comment me, I think I have the code well ordened and not problem to give you.

For  circles and box collision(without rotating) I have no problem.
But for isometric game I have to use or box with rotation or shape zone.

Have a try with these:
http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169
http://www.wildbunny.co.uk/blog/2011/04/20/collision-detection-for-dummies/

Thanks, now I study this!

#### matchy

• Prof. Inline
• Posts: 1542
##### Re: Collisions Question
« Reply #6 on: 2014-Sep-23 »

#### Kyo

• Dr. Type
• Posts: 350
##### Re: Collisions Question
« Reply #7 on: 2014-Sep-23 »

#### MrPlow

• Prof. Inline
• Posts: 1456
##### Re: Collisions Question
« Reply #8 on: 2014-Sep-23 »
Also for isometric there is a mathematical calc from ortho top down (cartesian) to iso and collisions could be calculated before the math that would translate the objects to the screen as isometric.

That way you could not need funny angles...

//Cartesian to isometric:

isoX = cartX - cartY;
isoY = (cartX + cartY) / 2;

So do collision based on cartX cartY and draw using isoX isoY
« Last Edit: 2014-Sep-23 by MrPlow »
Comp:
Speccy-48k, Speccy-128k, Amigas, PCs

#### Kitty Hello

• code monkey
• Prof. Inline
• Posts: 10697
• here on my island the sea says 'hello'
##### Re: Collisions Question
« Reply #9 on: 2014-Sep-24 »
Search for tritri collision. I have such a function. Somewhere...

Gesendet von meinem GT-N7100 mit Tapatalk

#### Kyo

• Dr. Type
• Posts: 350
##### Re: Collisions Question
« Reply #10 on: 2014-Sep-24 »
Search for tritri collision. I have such a function. Somewhere...

Gesendet von meinem GT-N7100 mit Tapatalk

In gl_b forum I can't find ...
sure that the name is tritri collision?

#### Moru

• Prof. Inline
• Posts: 1774
##### Re: Collisions Question
« Reply #11 on: 2014-Sep-24 »
There was something, I think it was in the showcase that could load polygons and maybe collisions. Could it be this one?
http://www.glbasic.com/showroom.php?site=games&game=AC3DPoly

I guess tritri means triangle - triangle collision.