How do I disable physics behaviour for just one Object?

  • Hello,

    iam trying to create a stacking box game where iam using the physics behaviour in construct3. Iam now wondering if iam able to deactivate the physics behaviour for just one object. Iam stacking the boxes (same spirte, object) on top of each other. It seems, when disabling some functions it will affect all the objects.

    The problem is: If there are a lot of boxes stacked on top of each other, the physics behaviour seems to hassle with those objects. And i have to move the ground down the Y-Axis to make this game "endless". When moving the ground (all boxes are joined to the previous one) there wobbeling (moving horizontally). The goal is to deactivate the physics behaviour from objects that are for example 4 steps previous the actual objec, or just generate a timeout for those boxes when moving the ground, to prevent bouncing...

    Another question: Would you use the physics behaviour for this? It has some nice wobbeling effects, when stacking some objects over each other. Think this cant be achieved just without this behaviour.

    Thanks for your inputs!

    Tagged:

  • Disabling physics for bottom boxes would probably not be a good idea, because other boxes will start falling through them. You can check if boxes are sleeping, and set them immovable.

    The problem with Box2D engine is that touching physics objects continue to wobble and shift a little and don't want to go to sleep. So you might need to check X/Y velocity and if these values are very small, set them as immovable.

    See this post:

    construct.net/en/forum/construct-2/how-do-i-18/detect-physics-object-finally-144877

  • dop2000

    Thanks for your answer. When moving the crates down (because i have to to make it endless) - all the physics objects are shaking - and this causes sometimes that a crate falls off...which causes you to game over.

    Do you know which solution would be best to move the content down? I tried phsyics-immovable, pinTo ground, etc. but nothing seems to be a safe method.

    I just want to avoid third party behaviours / plugins, because i made the experience, that i may cannot upgrade a project to next engine versions, because those plugins are not converted to those new engine requirements. Had this problem with some plugins from rex when working with construct2.. so this project is alltime stucked to construct2. My future me forbidden me to do this again :D

    Thank you very much!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just asking, but wouldn't another solution be to destroy objects that are lower than the bottom of the screen (to prevent lag from too many objects), and set the objects close to the bottom of the screen immovable to prevent too much wobbling?

  • cooly456

    Hmmm thats mitght be a solution. Basically the balancing should depend to the first set crate - but maybe youre right. It could be to sensitive over time. probably i will set the crates off the screen immovable or pin them directly to the ground.

    It seems there is no other way, because it gets unstable over time, when each object has its physically behaviours over the whole time.

    i will give this suggestion a try.

    Thank you!

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