Disable collision with specific object?

0 favourites
  • 5 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • Hi guys, i recently changed my game from using physics behaviour to using bullet instead because the physics were becoming quite erratic.

    The problem is , i had a system where when the left mouse button was clicked it would launch a ball which could pass over 'walls' i had in the game(Via on left-button clicked>Disable physics collisions with 'wall')

    This not only allowed the ball object to pass through/over the wall, but also didn't stop the player from being unable to pass through it(something i want). Now , since switching to the bullet behaviour , the problems i had with the movement of the ball being slightly erratic are gone, however the only way i can find of doing what i did before is to disable solid collisions when the left mouse button is clicked, this sadly allows the player to pass through the wall too and i don't want that happening at ANY point during the game.

    Can i make the solid wall permanently affect the player , but not the ball when the left mouse button is pressed?

    Thanks,Paul.

  • The bullet behavior won't be stoped by the collisions on its own. You would have to make a "on collision" -> "destroy" to make it stop when touching the wall, where the physics would do all the job. So there isn't a problem in fact, you just have to do nothing for the bullet to pass through the wall. Instead, you have to add events for the bullet to stop when it hits a real obstacle !

  • Thanks for the reply Guizmus, I may be misunderstanding you but the problem is that when i launch the ball with the left mouse button it should pass through the wall, and when i use the right button to fire it, it should collide with the wall and stay in the 'lane' that the player is in. So when i left click, the only way i've been able to have it pass over the wall is to disable solid collisions with the wall in general, which allows my player to also pass through(what i don't want) , the right click isn't a problem off course because i have that set to re-enable the collisions with the wall and thus it works fine even after left-clicking.

    However if i was to left click to pass the ball over the wall, receive it back again and then before i right click to fire it inside the lane i go in the direction of the wall, i pass through it.

    Only once i click the right mouse button again are the collisions re-enabled and that seems to be where my problems lie.

    Also when i refer to collisions now, i'm referring to the solid behaviour and NOT the physics collisions,

    because i've taken all physics behaviour out of the game due to unsatisfactory results with the way the ball moves.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Also I'm taking a look at the events tutorial in your signature and it seems to suggest it might answer some of the questions i've had as a new construct user, thanks for taking the time to write it up.

    Paul

  • Hey Paul,

    Happy my tuto was useful.

    About your problem, providing a sample capx could help understand what isn't working right now.

    In doubt, I tried this capx where left click makes a bullet going through the wall, and right click makes it bounce on it. Not sure this is exactly what you needed though, but the events logic can then easily be changed, it was the collision detection that was your problem if I understand well.

    Btw, when you're waiting for an answer from someone, or talking to someone in particular, try to add "@name_of_the_person" in your message so he gets notified ;)

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