Impacting objects differently using box2d

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I've played around with box2d the last couple of days and I really like this engine.
    I have a minor issue revolving around impacting different objects of the same instance differently.

    Right now, I have an attack which hits an area around the player.
    Imagine I have a scene like this:

    O__P__O

    The O's being boxes, and P being the player. When he attacks, he hits both of these objects. Now consider this code snippet:
    -Attack Detection is overlapping Box
    -Attacking of Player is 1
    -X Position of Player <= X("Box")
    +Apply impulse, force 70, angle 45 + Random(15) degrees

    -Attack Detection is overlapping Box
    -Attacking of Player is 1
    -X Position of Player > X("Box")
    +Apply impulse, force 70, angle 135 - Random(15) degrees

    When the attack is performed, they both fly to the right, which shows the first code snippet is being fired for the both of them. I obviously want the left box to fly in the other direction (and it does work, if I only hit that box from the right side, without hitting the box to the right).

    I was looking into using the ForEach object, but that didn't work out for me.

    Can anyone help me? :) Thank you.

  • New question concerning box2d (title still applies so I'll post my question here).

    I'm trying to make a chain (using the box2d Physics - Rope and Chain object) move when the player touches it, based on direction.
    Thing is, it seems I need change the object type of the player (which is just a square at the moment) into one of the physics movements for it to work?
    I'm using a custom built movement type for the player and I don't want to use any other movement type.

    I thought I could do something like:
    - PhysicsChain: An element collides with "Player"
    + For each element, loop name "movechain"

    - On loop "movechain"
    + Do something here, like add impulse per element in the chain

    The options I need for the chain to move are just simply not there?

    Not sure how to do this properly. Does anyone know?

    Perhaps I need to create a combination of joins to create a different chain, rather than using the Physics - Rope and Chain Object?

  • I'm not sure how possible that is. However, as a work-around, you could try making an object with the physics static movement, make it ignore gravity (set the gravity value to 0), always set the object's angle to 0, and always position the object to the actual player object, and then test for collisions with the object with the physics static movement, and make the object with the physics static movement invisible. It might work, though I'm not sure.

    My Please login to see this link. (which I actually use), my Please login to see this link. (which I mostly don't use), and my Please login to see this link. (which I don't use anymore pretty much at all really). If there are awards for "'highest number of long forum posts", then I'd have probably won at least 1 by now. XD

  • I had actually tried that, but couldn't get it to work. It seemed I forgot about the Gravity modifier. D'oh. I made the chain "Stop" when any of its elements collided with the Player Physics Detector I made. I also had to tick "Fixed Angle", or the PPD would rotate when it hit the chain.
    It does work, kind of. It stops the chain from swining, but I can't find any command to make the chain move along with the PPD if it's not in motion.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!