Problem checking collision between two Physics Object ?

0 favourites
  • 5 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • It seems that the condition "Object1 => On collision with Object2" is not triggered every time when the two objects have the Physics behavior. This is especialy true when the objects are colliding on a "flat" surface from their respective hitboxes.

    The collision is clearly visible on screen and everything looks ok with the physics, but "On collision" is not triggerded.

    After a few tests, it appears that the contact points (with expression "Physics.ContactCount") are allways correct, but "On collision" is sometime not triggerded even if ContactCount > 1.

    In my tests, no other conditions than "On collision" where involved and there is only two Physics Object (two different Sprites, not the same instace).

    Am I missing something when I check the collision between Physics Objects ?

  • Post your project file so it can be diagnosed

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • After a few more tests I found that the collision trigger is not the source of the problem. This is the contact point that is not "triggering".

    You can test it in this capx : 1drv.ms/u/s!AkLLauK5GG7Cg8krl0rDeu3d-cuI6A

    You control the big green thing (this is basically the file I use for the players hitbox in my project. I swear that this is NOT what it looks like ^^'). You control it with the keybords arrows, via physics forces and torques.

    The smaller green object is basically an enemy's hitbox and the black rectangle is an imovable object.

    If you jut go foward and collides with the "enemy", you will notice that the texts object at the top left corner will show the collisions and the number of contact points. You should also noitce that sometimes (like 10%), the ContactCount will not change, despite the collision effectively happens.

    The easiest way to experiment this is to "push" the enemy to the black imovable object and than go for a number of collisions with it by just going backward=>foreward. You should sometime see the contact counter stay the same despite the collision counter go up.

  • In your physics properties for each object, enable the "bullet" setting. This enhances the collision detection for physics objects.

  • It was THAT easy ! thanks a lot.

    I tested everything but I forget to check the "bullet" box, lol. Its working perfectly now.

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