I have list of objects:
list = {{1, 1, 0.05, 0.05}, {2, 2, 0.05, 0.05}, {13, 13, 0.05, 0.05}};
list = {{x,y,Vx,Vy},{x,y,Vx,Vy},...};
And
object = {10, 10};
I want when I change position of object the objects from the list to follow the first object.
I try with this:
If[object[[1]] < #1 && #3 > 0, list = {#1,#2,-#3 ,#4}, list = {#1,#2,#3,#4}] &@@@list
If[object[[1]] > #1 && #3 < 0, list = {#1,#2,-#3 ,#4}, list = {#1,#2,#3,#4}] &@@@list
If[object[[2]] < #1 && #4 > 0, list = {#1,#2,#3 ,-#4}, list = {#1,#2,#3,#4}] &@@@list
If[object[[2]] < #1 && #4 < 0, list = {#1,#2,#3 ,-#4}, list = {#1,#2,#3,#4}] &@@@list
and works but only the first cycle. I know that I can do this with:
If[object[[1]] < list[[1, 1]] && list[[1, 3]] > 0, list[[1, 3]] *= -1]....
But is very slow and not look nice :). And doesn't work completely correct.