Make a group of sprites ripple when another sprite collides with them? - sprite-kit

I have created a basic animation that consists of a 3x3 grid with square sprites dropping into this grid from the top, then dropping out once the grid is full.
I would like to send a ripple through the sprites already present in the grid when a new one joins them (from the origin of the new sprite). I have not used SpriteKit before so am a little unsure of where to go from here; do I need to use collision masks? How do I cause that collision to be passed through the sprites?
Any pointers would be appreciated.

Related

Detect collisons only on the border of a collider,How to detect collisions only on the border of a collider but not inside?

I am creating a 2D game and I want to implement two game objects with circular colliders to detect collisions following say an object is travelling from Point A to Point B then -
See the image for details
Thanks for the help
I think the easiest answer is to just make a polygon collider 2D that looks like a ring, like so but without the gap and much thinner:
Then you can use OnTriggerStay2D to run the code you'd like to run on collision.

How to make Quads flush with each other

I'm making a game where I move a red cube across a plane with arrow keys (I am setting the velocity in order to get a constant speed) Here is a preview:
game
Currently, I am just using a plane with a grid material/texture. However, I wanted to change one of the tiles in this grid to a different color and detect when my cube passes over it.
My idea was to simply replace the plane with a bunch of quads. However, when I do that and try to navigate my cube across the quads, it seems to collide with the side of the quad and flip up, despite the fact that they are all at the same height and positioned right next to each other.
Is there a way to make the quads flush so when I push my cube over it, it won't collide with the side of the quads? Is there a better way to create this behavior?
You can disable colliders at this quads and add invisible big plane with collider

Collider for blender pot model inside Unity

i've made a simple pot model inside blender:
So the idea is that after importing to unity, generating mesh collider, adding ridgin body i would like to be able to put smothing inside the pot. Now it's generating collider but without a "hole" inside, so if i throw smth inside it just bounce off the top. Is there any way to do it simple way? I'd like to avoid making a collider by hand in unity, using cubes and so...
Image overview:
Your collider needs to be concave
It isn't clear from your question how you're "generating mesh collider," but the results are clearly generating a convex collider.
That said, some things to know about mesh colliders (and concave ones even more so): They are very compultationally heavy to calculate, so they should never...
move
scale (especially non-uniformly)
rotate
...at runtime.
Alternatively you can use multiple box colliders in the same orientations as the side-segments of your can (along with one or two for the bottom, depending on how small of an object you'll be dropping inside).
Uncheck the generate collider box from the import settings, add a mesh collider component and check convex.
I would use four or six box colliders for the walls of the pot and another for the floor. You can scale each box collider along each axis, but if you want to rotate a box collider you will need to give it a parent and rotate the parent. Box colliders are very low cost for the physics engine compared to mesh colliders.

How to move a tile (sprite) with drag and drop in Unity 2D?

I would like to move a tile with drag and drop in Unity 2D. The tile is a sprite. The scene is an 'Unblock me' or 'Blocked in' like gameplay.
Because the tiles in real life correspond to physical objects it seemed be to a good idea to model them with colliders and rigidbody. The border of the table surrunded with invisible colliders. I hoped these will constrain the moves of the tiles realistic, when the player moves them.
Then I implemented a simple (mouse based) drag and drop behavior which is worked perfectly except the moved tile penetrates to other tiles and the border, and sometimes jumps over them. Then I learned if I am overriding physics by explicitly setting transforms position (which I do exactly in my drag and drop implementation), this will happen. OK I accept, I should set only forces, ect. on rigidbody never directly the position.
Now the question:
I am stuck here. I still want to drag and drop like user experience, and some realistic visual result. When in the real life a player moves a tile, it seems it is "glued" to its finger. How can I achieve this (ot at least similar) with just applying forces? Any suggestions or point similar existing sample/blog code?
(I know as a backup plan I can omit all the physics and constrain the tile positions by code, and create some tweens to move the tiles. Is the real solution (what I am asking for) so complicated I should vote on this backup plan?)
Edit
According to comments I've added a video:
There is nothing wrong with the way you are manipulating your dragging. The beauty of developing is being able to do things in your own way. If it works for your game, then don't fret.
Now, i recommend:
Create a new physic material. Assets > Create > Physic Material
Set your new physic material inspector settings both to 0
Attach the physic material to all your wall object colliders. This should allow for your object being dragged to move smoothly against the walls without chopping.
Do a check to see if your mouse is over another collider. If so, then stop the movement in that direction.
Since your movements seem to always be on a single axis, on collision, tell your object to snap to the edge of the wall object. You know the Wall position and scales, also you have the position and scales of the object being dragged. with that you can write a function that will offset it to the correct position when the collision occurs.
Let me know if any of that works out :P

Breaking up a sprite in cocos2d

I'm making a 2D plane fighting game for the iPhone in cocos2d. I'm trying to make it so when you shoot an enemy plane, it breaks into a couple of separated pieces that will fall out of sight. What is generally the best practice for breaking one sprite up into many? should I create new images for each separate piece, or treat the initial image like a sprite sheet, and make a new sprite from segments?
Please look at this tutorial
It makes a grid of points then moves the internal (not-edge) ones around randomly a bit so it's not all perfect triangles. Then each update it moves/rotates the triangles separately--then draws them all at once.
You treat the whole thing as a sprite, so can run any of the usual actions on it. This example uses CCMoveBy to move the whole group down off the bottom.