How do I find collision points?

0 favourites
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • I'm converting a Construct 2 project to a Construct 3 project, and I'm a little sad to say that in many regards I feel like I'm having to downgrade things.

    For example, in Construct 2 I was using the wonderful Chipmunk physics engine.

    I was able to have two objects collide, and create debris from that collision point. I was also able to find out how strong said collision was, and change the audio based on that.

    Does anyone know if such a thing is possible in Construct 3? And if not, might this be added in the future?

  • There is a method of detecting the point of collision, but it's quite complex and requires you to duplicate collision polygon with image points:

    howtoconstructdemos.com/detecting-the-exact-point-of-collision-between-two-large-objects-capx

    You can use this addon to read collision polygon coordinates, in this case you'll not need image points:

    colludium.itch.io/polygon

  • create a mini bullet SpriteC move angle from A TO B when C is overlaping A and B you can find the collision point

  • wertt22 That method will not always work correctly.

  • bullet angle need +1 everytick

  • I don't see how this can help. Even if you use LOS raycasting instead of the bullet.

  • I'm with Dop2000 on this one. I don't believe having the object shoot the other one will help unless both shapes are perfect circles, no matter what random rotation I put in there.

    Chipmunk simply did this automatically.

    Sadly, I'm really starting to regret moving over to Construct 3... :(

    As brilliant as it is, Construct 2 just seems more capable.

    Currently trying to figure out how to get the Drawing Canvas to draw using a circle pen rather than a square. Who draws with a square pen???

  • set point for your Sprite shape and let the mini bullet Sprite move angle from point first to last

  • or set a mini Sprite pin rope to your shape Sprite and set the mini Sprite move angle same to your shape Sprite

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • wertt22 Wow, you have lots of ideas. Can you back up any of them with a working demo? :)

  • Sorry wertt22 I'm afraid I don't understand what you mean. I'm getting very confused.

  • Currently trying to figure out how to get the Drawing Canvas to draw using a circle pen rather than a square. Who draws with a square pen???

    Have you tried setting "Line cap: square"? You can also draw on the canvas by pasting sprites and TiledBackground objects.

  • For a fairly straightforward way of getting the collision point you can take all the points of one object’s collision polygon, and see if they overlap the other object. Then do the same for the second object with the first. Then, for all the points that do overlap just average the positions together to get a collision point.

    There are more robust ways, but it should work in most cases. One case where it would fail is if the objects are severely overlapping and no points overlap, just edges.

    For the impact sound it basically boils down to:

    Velocity_after - velocity_before

    Maybe Every tick save the old velocity to some variables. Then on the collision, after stopping or bouncing the object, subtract the velocities to get the impulse.

  • > Currently trying to figure out how to get the Drawing Canvas to draw using a circle pen rather than a square. Who draws with a square pen???

    Have you tried setting "Line cap: square"? You can also draw on the canvas by pasting sprites and TiledBackground objects.

    I have indeed tried line cap: square :) It simply makes everything look like it's drawn without antialiasing XD

    It would be nice if we had a little more control, even in things such as brush hardness, etc.

    Hey R0J0hound good to see you again!

    That's actually a very good method, but might I ask how I access the object's collision polygon? At the moment, all I can think of is creating an image point at each collision point. I've tried looking in conditions for both the system compare and the object's conditions, but I don't see it anywhere.

  • AnD4D It looks like in your C2 drawing example you used round cap?

    Here is an addon that allows to read collision polygon coordinates.

    colludium.itch.io/polygon

    This method may not work with some collision polygon configurations or if objects are moving quite fast, for example:

    Objects collided, but none of the points is overlapping another object.

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