How can I check if an object is inside another triangle-shaped object?

Not favoritedFavorited Favorited 0 favourites
  • 4 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • I'm making a Tangram game, but I need to check if my triangle is inside an image made up of multiple triangles and other shapes.

    I used the expression BBox in another game, but in this game it doesn't work, can anyone help me?

  • Sounds like one of those situations when thinking the opposite will get you started on a solution.

    Check if it is NOT outside the area. "is overlapping" will use the collision polygon, BBox will use the whole square around your object.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Sounds like one of those situations when thinking the opposite will get you started on a solution.

    Check if it is NOT outside the area. "is overlapping" will use the collision polygon, BBox will use the whole square around your object.

    it makes sense, maybe I have to do an inverted calculation anyway

  • If both triangles are about the same size you could just check if their positions are about the same. For example abs(tri1.x-tri2.x)<8, and the same for y. 8 would be how close is ok.

    Another idea is to check if all three corners of one triangle are overlapping the other triangle. You’d do that by adding an image point to all three corners and use the system condition “pick overlapping point”.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)