How do I disable physics behaviour with this setup?

0 favourites
  • 7 posts
From the Asset Store
A set of sci-fi / cyberpunk themed platformer characters
  • Hi,

    I have a couple of objects with the Drag and Drop and Physics behaviours.

    I'm trying to get it so that the physics behaviour is disabled when the objects are dragged onto the pink area in the screenshot, then enabled again when dragged onto the yellow area. I've tried "object is overlapping" and "on collision with" but the physics behaviour stays enabled. Please help.

  • It's not recommended to drag physics objects when Physics is enabled.

    But what you described should work. Try something like this:

    Sprite is dragging
    
    ..Sprite is overlapping PinkArea : Sprite set physics Disabled
    
    ..Else
    ..Sprite is overlapping YellowArea : Sprite set physics Enabled
    
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Could be a for each problem.

    Physics stay enabled because one sprite is outside the pink area, so you have to use a for each loop to enable/disable physics for each sprite.

    for each sprite event, then add overlapping conditions as sub-event there

    Anyway, that would be my guess

  • Hi dop2000 and BadMario,

    Thanks for the reply. The physics behaviour is still refusing to disable but that might be because I haven't set the subevents up correctly. Is this right?

  • The code should work. How do you know that physics is not disabled, have you checked in Debug mode? Try adding Browser Log action to these events, see if they fire. Check collision polygons in all objects. Or maybe some other event is enabling the behavior.

  • Hi dop2000,

    I recreated the setup in a new project and it worked, so something must be preventing the behaviour from disabling in the existing project. How do I add the Browser Log action?

  • Add Browser object to your project. Add "Browser Log" action to the events you want to debug.

    Start the preview, press F12, open Console log and check your debug messages there.

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