BASIC

Author Topic: Collisions Question  (Read 2824 times)

Offline Kyo

  • Dr. Type
  • ****
  • Posts: 350
    • View Profile
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!

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1773
    • View Profile
    • Homepage
Re: Collisions Question
« Reply #1 on: 2014-Sep-23 »
Short answer: No.

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.

Offline Kyo

  • Dr. Type
  • ****
  • Posts: 350
    • View Profile
Re: Collisions Question
« Reply #2 on: 2014-Sep-23 »
Short answer: No.

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  :nw:


Offline mentalthink

  • Prof. Inline
  • *****
  • Posts: 3365
  • Integrated Brain
    • View Profile
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.

Offline Kyo

  • Dr. Type
  • ****
  • Posts: 350
    • View Profile
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!  :good:


Offline matchy

  • Prof. Inline
  • *****
  • Posts: 1540
    • View Profile
Re: Collisions Question
« Reply #6 on: 2014-Sep-23 »

Offline Kyo

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

Offline MrPlow

  • Prof. Inline
  • *****
  • Posts: 1442
    • View Profile
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...
 :P

//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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10695
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
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


Offline Kyo

  • Dr. Type
  • ****
  • Posts: 350
    • View Profile
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?

Offline Moru

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 1773
    • View Profile
    • Homepage
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.