Problem with colliding blocks
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
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
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
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
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?
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
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?
----------------------------------------------
http://www.davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
Back to beginning: How to create strip build with movable and draggable blocks, that you can slide vertically, and it should be wrappable too ;-)
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