Collision detection for non rectangle/circle images

jmshaulljmshaull Member Posts: 3
edited November -1 in Working with GS (Mac)
My understanding is that for collision with odd image shapes you need to add rectangles behind that image for the proper image collision affect. For example, a collision on a star image would need 10 rectangles at different angles behind the star image.
So many actual problem is that I need that star to be movable in game with collision detection. However I cant do this because those rectangles behind the star image will not move with it. Is there a way to attach these rectangles to the star image? Does anyone have experience with this?

Thanks, Josh

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi jmshaull; you can put multiple invisible shapes in front of your star image if you like but it's probably going overboard. Multiple invisible actors for collision detection is used more for things like hills, or some really wacky shape. So one square would be enough for a star. OK, it might not be 100% accurate based on the star's shape but good enough. If your actor is moving, you need the invisible actor to follow it exactly by using constrain attributes to match the star's changing x and y position.

    In any actor's edit window, you can make collision detection square or circle, for interest. And finally, "proper" collision detection, i.e ignoring alpha and colliding with actual shape, is on GS's roadmap for a future release.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jmshaulljmshaull Member Posts: 3
    Thanks Gyroscope
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Edit: whoops, silly me, I must be getting tired: basically then, if you only need one square for collision detection, in other words your actor image will fit to rectangular/square (or circle) then you don't need any extra invisible actors! Just put the collision detection in the actual star actor, in this case.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • dotsonj23dotsonj23 Member Posts: 316
    gyroscope said:
    Hi jmshaull; you can put multiple invisible shapes in front of your star image if you like but it's probably going overboard. Multiple invisible actors for collision detection is used more for things like hills, or some really wacky shape. So one square would be enough for a star. OK, it might not be 100% accurate based on the star's shape but good enough. If your actor is moving, you need the invisible actor to follow it exactly by using constrain attributes to match the star's changing x and y position.

    In any actor's edit window, you can make collision detection square or circle, for interest. And finally, "proper" collision detection, i.e ignoring alpha and colliding with actual shape, is on GS's roadmap for a future release.

    :-)

    Is ignoring alpha for collision purposes really on the roadmap? I see polygon collision (i.e, objects with more that 4 straight sides) but that is all I see. Polygon collision will not really help with things like curved (but non-circular) actors. I suspect we are only talking about polygon collision since they are working of Box2D engine and it does not currently have ignore alpha capabilities. But if I am wrong that would be awesome since I am getting really tired of using rectangles at varying angles to simulate a hill. Plus boy would it save on have to use constraints for moving irregular shapes.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    dotsonj23 said:
    Is ignoring alpha for collision purposes really on the roadmap? I see polygon collision (i.e, objects with more that 4 straight sides) but that is all I see. Polygon collision will not really help with things like curved (but non-circular) actors. I suspect we are only talking about polygon collision since they are working of Box2D engine and it does not currently have ignore alpha capabilities. But if I am wrong that would be awesome since I am getting really tired of using rectangles at varying angles to simulate a hill. Plus boy would it save on have to use constraints for moving irregular shapes.

    Ah, thanks for correcting me, dotsonj23. Proper collision detection by ignoring alpha must have been my wishful thinking - reading "polygon" and then amending it in my mind! It sure would save some stuff as you say + be nicely accurate if it ever happened. Oh well.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • jmshaulljmshaull Member Posts: 3
    wow this doesnt seem possible, this is a huge turnoff for me.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    jmshaull said:
    wow this doesnt seem possible, this is a huge turnoff for me.

    It is a shame but not that bad, surely! We still have collision detection at least, just not as refined. :-)

    I've been thinking about polygon collision detection; this system is used in 3D gaming, as you know. So it got me thinking: GS isn't going to include true 3D capabilities some-time soon (i.e probably never) so if it uses the phrase polygon collision in the Roadmap, perhaps it can be utilized in 2D?
    dotsonj23 said:
    ...since they are working of Box2D engine and it does not currently have ignore alpha capabilities.

    Perhaps the Box2D engine has or will have the ability to convert shapes into polygons in one plane, coding-wise, then the collision detection stuff applied? That would be accurate to 2D irregular shapes, ignoring alpha without even trying!

    What are your/anyone's thoughts?

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Sign In or Register to comment.