Moving Balls

Hi!

I need some explanation and solution for moving multiple Gameobjects (balls) at same time.
On screen touch I detect position and direction of finger movement. At same time, I find the object I toched (if I touch some).
In phase.moved i calculate if movement is on x or y axis, and after that I move all objects in same row or column.
For moving objects I am using rigidbody.AddForce.

Problem is that object are not synchronized in moving (they havenot same speed). Also they sometimes collide with objects In other row or column which I don’t want.

What are possible solutions?

maybe you could put all the balls into an array, and then move the array?

@The OP: I’m not sure what you’re asking here, but I have a feeling (based on what you posted) that maybe you don’t want to be using the physics system for this. (If this is some sort of puzzle game involving spheres in rows or columns, and in which rows/columns of spheres can be shifted one way or the other, then I would not use the built-in physics system, but rather code the behavior directly.)

I put all the balls into array. I also use this array for calculating if balls are same color.

Jesse, game is like a puzzle, but balls have to roll like a real balls do.
The main problem is that balls collide objects next to them.

Do you have some code example used for moving objects like in a puzzle.

That doesn’t necessarily mean you have to use the physics system (there are other ways to create the appearance of rolling).

Without knowing exactly how the puzzle and the user interface works, I can’t really make any specific suggestions.

Sounds like you shouldn’t be relying on the physics system if you don’t want unpredictable results. Why not assign all the balls you wish reposition to a new parent gameobject (This could be instatiated at runtime or already exist in your scene). modifing the transform of the new parent will effect the transform of all it’s children. You can lerp the transform of the parent to it’s new position and apply a calculated rotation for each child based on the distance traveled. This would give the visual impression that your balls are rolling to the new destination and will also keep everything in sync. Once your done with the move detach the balls if required remove the temporary game object.

Thanks for your suggestions