Collision mask physics behavior doubt

0 favourites
  • 5 posts
From the Asset Store
Basic template for drawing game with masks and easy customization
  • Hello developers,

    I have a doubt about the collision mask property of the Physics behavior.

    I have created 2 sprites.

    - 1 simple box with default collision points (4 collision points 1 for each corner)

    - 1 circle with customized collision points (a smaller 4 collision points into the circle) and the physics behavior active.

    Then I've included some simple events to let me play a bit with the sprite:

    The point is that whatever collision mask property I select (Use collision polygon, Bound Box, Circle) it seams Construct 3 is using "Use collision polygon"option.

    If I reconfigure the Circle sprite with collision mask "Circle" and I try to overlap the Circle sprite with the box they actually collide when the customized collision polygon overlap the box. What actually I would expect is that the virtual circle polygon mask it collide.

    Is that a bug or I do miss something?

    thanks for your help folks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not possible to tell what's going on from your description. Post up a link to a simple c3p file and we'll take a look.

  • When you choose "Circle" for physical object, it only affects mask for Physics behaviour. For conditions like "on collision" or "is overlapping" game still uses the collision mask, so AFAIK the closest you can get to your desired result is by making collision mask with more points around the circle.

  • You're right about the is-overlapping condition - the overlap check doesn't interrogate the Physics library, it only uses the collision polygon. The on-collision trigger should call when box2d registers a contact between the bodies - if that's not working then it might be because you're moving the body using set position rather than by giving it a velocity or applying a force. Box2d doesn't handle that sort of movement input at all well, unfortunately.

    Physics will try to prevent the objects from overlapping. If you want the on-collision to register correctly then you could do something like:

    -Circle : Set Velocity : VelocityX = (Mouse.X - Circle.X) * factor

    VelocityY = (Mouse.Y - Circle.Y) * factor

    You'll need to experiment with the value of factor to get the effect you want.

  • Thank you everyone for your attention.

    You are right. Circle mask works while dynamic world is moving and not if the object is moved manually.

    See the example below:

    https://drive.google.com/file/d/18dnBH6PlsyF23TAWt8tQIGVNssTkvm7c/view?usp=sharing

    Colludium I will try your suggestion to see the behavior.

    Is the Circle method a Construct 3 or a box2d design/limitation?

    thank you all

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