check if between two objects

  • so far i've managed to check with a virtual line, but it's not quite there yet since it only checks for the center point of the object between.

    i'd love to use the "is between angle of" but it doesn't seem to work that way since i want to check if angle1 is between X of angle2.

    I want to be able to check for the whole object, not just the center of it, and i don't want to use an extra object to check for collision (which is what i had been doing)

    capx

    any ideas?

  • Hmmmm Personally I would stick with the Extra Object with Overlapping Detection..I use them for most of my checks...They function exactly like Raycasting in 3D..

    What was the main issue with using a Faux Ray cast object..I think they work fine..

    You would only need a single object in that example CapX...

    And just check Overlap for each box and update your Variable to show the Object number that is between the two points

    The only issue you would have there is if the Ray Cast object overlaps more than a single Block...But I am guessing that you would have the same issues with your Virtual line..

    I tried the ray cast and it works fine...Not quite sure why you dont want to use them

    Can you elaborate on your Problem?

  • I don't have any problem with the check lines, I've been using them so far.

    The virtual line is pretty much the same, but with less objects on the layout and with several less event-lines. My project is quite large (+800 lines) and i'm looking for ways to improve wherever i can.

    I manage to make the virtual line, and it works with as many instances as you want too. The only problem i have left is that i can only check for the x&y coordinate, and not for the sprite's shape. But i'm guessing that i can work around that using a custom "coordinate is greater than angle1-5 and less than angle2+5" where 5+5 is the approximate size of the object i'm checking for.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I guess you can use line(segment)-circle intersection, and use circles to represent your objects, it's much easier and faster then with poligons (just define circle size depending on the size of sprite to aproximate spite's shape)...

    here are some algorithms(first is simplest and I think it's what you need)

    Simple without intersection points

    Simple with intersection points

    Antoher way with intersection points

    Yet Another way with intersection points

    edit: line between points is just representational stuff, its all besed on math

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