How do you do accurate collision detection on non-round/rectangle objects?

Collision uses a circle or rectangle of the actor to deter collisions, but I'm trying to do detection on a basically isosceles triangle ship. With the rectangle setting, it looks like things are colliding before hitting the ship, and with circle it sometimes looks like things are passing through.

My thought is to make the ship out of multiple smaller actors constrained to each other, but that seems like a big pain. Does anyone have a more elegant solution to this?

Best Answers

Answers

  • Young ZaphodYoung Zaphod Member Posts: 7

    I thought that might be the case but wanted to make sure before I built my game on that.

    Thanks!

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2014

    @Young Zaphod said:
    I thought that might be the case but wanted to make sure before I built my game on that.

    Thanks!

    Like I say it's very straightforward, especially if the triangle is either static in one position (as in games where the actor stays in the middle of the screen and the environment moves) or if the triangle is moving around the screen but not rotating - then it's a simple case of throwing three long actors into the scene rotating them to the desired angle and constraining them to the main actor to form the triangle . . . . if on the other-hand the triangle needs to move around the screen and rotate and spin and so on, then you need to use a little trigonometry, if you're not familiar with cos and sin then - I've made a device that does all the maths for you . . . .

    Link: http://forums.gamesalad.com/discussion/62202/linkmachine

    . . .

  • Young ZaphodYoung Zaphod Member Posts: 7

    Thanks Socks - unfortunately I have my space ship both rotating and moving around the screen, but fortunately having an engineering degree I have a good understanding of all the physics and math stuff involved. Getting that into GS is another story since I just started this two days ago...

  • SocksSocks London, UK.Member Posts: 12,822

    @Young Zaphod said:
    Getting that into GS is another story since I just started this two days ago...

    Did you check out the link I posted above, it does all the work for you.

Sign In or Register to comment.