Problem with colliding blocks

onuferonufer Member Posts: 17
edited November -1 in Working with GS (Mac)
I got few rectangular blocks in my project. Each one is touch sensitive and can be moved - following the touch. The idea is to move one block with another. I control one actor and when I collide with other it shoud move. The effect I am trying to gain is like with two or more solid, inflexible boxes, when they bump. But all I can get till now is like my actors are made with jelly. Ok. They react when collide, but very elactic. And before one block moves another, it gets over him for a while. What am I doing wrong?

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi onufer, you're not doing anything wrong: unfortunately, when dragging with Touch, collision detection doesn't register proprly.

    I've seen a few workarounds over the months (I tried one myself at one time) but they're still not as good as the real thing (i.e proper collision).

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    So there is no way to do smthing about that? I was trying to play with attributes: density, friction, restitution... but it doesn't work :/ Is there any trick, to make it working better than now?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    I've just realised that I was talking about an actor being moved by touch and then colliding with a wall actor having some problems.

    So thinking about your problem again, try putting a set of Collide Behaviors in each of your blocks and see if that works. (I've just done a test with a draggable actor and another actor with just one collide behavior - when colliding with the draggable actor - and it does get pushed). Hopefully this'll work out for you.

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    In my project every block is draggable. (Can be). And when i slide one block, and collide it with another ther is push. But they react like two pieces made of jelly. One get over another, and just then there is a push effect. Thats not all. If movement is qucik, blocks go one over another and they get stuck. I have one collide behaviior for all blocks: just "bump when collide with actors with tag" I have also behavior: self rotation = 0
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Have you added all the collide behaviors in each of the blocks' Rules?

    Example: say you have four blocks, let's called them B1, B2, B3 and B4.

    So in B1's Rules:
    Collide Behavior collide with B2
    Collide Behavior collide with B3
    Collide Behavior collide with B4

    B2's Rules:
    Collide Behavior collide with B1
    Collide Behavior collide with B3
    Collide Behavior collide with B4

    etc.

    As for them being pushed like pieces of jelly, not quite certain what you mean... they quiver/shake? Is the Density or Friction set too high maybe? (Try Friction as 0, for instance).

    If you have self.rotation set to 0, is this because you don't want any of the block to rotate, or something else? ("Well, d'uh..." you might say... ;-)

    Seriously, maybe all you need there is to check Fixed Rotation in Physics.

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    I said jelly because they act like soft material. Not like solid square boxes. Or maybe only bad collision makes it looks like that. Because as I said (in my limited english;-) there is something like latency/inertion. Dragged block collide with another, and pushes it, but... after getting a little bit over it. And when I make quick move with dragged block it gets over opposite block with all its area and stucks. Collision doesn't work. Or I am doing smthing wrong...

    Self rotation is set to 0 because I don't want any rotation when actors collide.

    Maybe I should say more about whole idea. Blocks are set one over another. They form vertical strip, and move only up or down verticaly. I touch one block, or another and slide it up or down and the rest of blocks shoud be pushed relatively to that move of dragged block. One more thing. I want this strip made of blocks to wrap if some block goes out of scene.

    And it works. Except collision model ;-) Blocks don't collide properly. I described it above ;-) Or maybe I shout rethink whole idea. I mean find another way to make what I want. But for now I am asking about help with collision problem. Why it doesn't work?
  • onuferonufer Member Posts: 17
    I made video to demonstrate how it looks like. Mouse arrow is not visible, but of course I am making movement by dragging blocks ;-) Here is link:

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Your English is fine, onufer!

    I haven't had time to think this through yet to see if I can come up with a solution but I will get around to it; unless another forum member can offer more advice.

    In the meantime: you've made sure that all the collision Behaviours are there? (By the look of your vid. example, each block only needs two). As long as that's all OK, try a little experiment, if you wouldn't mind: put a one pixel space between each block and see if anything changes then.

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    As I said every block has only one simple collision behavior: "bump when collide with actors with tag: block". I thought that would be enough. But I will try what you suggest. I will create exact behavior for each actor: how to react when nearest neighbours are colliding witn him.

    Then, if I still will not have any improvement, I will put space between blocks ;-) But... I am not sure what are you talking about ;-) You mean to create rule about that? Or just to place blocks on scene not so close?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    onufer said:
    As I said every block has only one simple collision behavior: "bump when collide with actors with tag: block". I thought that would be enough. But I will try what you suggest. I will create exact behavior for each actor: how to react when nearest neighbours are colliding witn him.

    It might help...
    onufer said:
    As I said every block has only one simple collision behavior: "bump when collide with actors with tag: block". I thought that would be enough. But I will try what you suggest. I will create exact behavior for each actor: how to react when nearest neighbours are colliding witn him.

    Then, if I still will not have any improvement, I will put space between blocks ;-) But... I am not sure what are you talking about ;-) You mean to create rule about that? Or just to place blocks on scene not so close?

    So that the blocks are not actually touching; yes, not so close. My thinking is that the collision detection will be better...

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    I made this two things... And collision model didn't changed ;-) It still don't work properly :-/ I even made actor called "gap". Thin wall between every two blocks. Nothing changed :-/ I don't know if my problem is uniqe and interesting enough to drag attention of GS masters ;-) , but for me is strange. Collision model that work fine in so many projects and situations, don't work for me. Why? Am I understanding smthing wrong? Hmmm...

    Back to beginning: How to create strip build with movable and draggable blocks, that you can slide vertically, and it should be wrappable too ;-)
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi onufer, I wish I was a GS Master! I'm fairly experienced with GS but there are guys here more knowledgable than I. Still, I try my best...

    Concerning the gap between the blocks, I meant an actual gap, i.e moving each block away from each other by a small amount so they are not touching at the beginning of the game. No other additional actors needed.

    hopefully that might help, but if not, I'll see if I can find some time to duplicate your file based on your video; but I can't promise when though...

    ----------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • onuferonufer Member Posts: 17
    Frankly speaking, I am so happy that you are trying to help me, that I can't even express it ;-) Because I am fresh here and feel a little bit lost and "alone" ;-) I hope that it (solving my problem) will bring you also more experience in GS using and your time will not be lost ;-) Generally, maybe this cause or similar was not considered earlier. And we can enrich data base here :-P
Sign In or Register to comment.