Hello.
I develop some model (lets call it GlobalCube) consisting of cubes.
The main objective is to make a split.
I click on one of the cube (part of GlobalCune), then press Shift + Left Arrow and all parts from one side of GlobalCube (
regarding of taregeted litle cube-part) should start moving.
List<Transform> children;
...
void Start () {
..
children = new List<Transform>(Global.GetComponentsInChildren<Transform>());
}
void LastUpdate{
..
if (Input.GetKey(KeyCode.LeftShift) Input.GetKey(KeyCode.LeftArrow)){
for (int i = 1; i < children.Count; i++){
if (children[i].position.x <= target.position.x){
children[i].Translate( -Vector3.right * Time.deltaTime);
}
}
}
But it was astonished with the result.
Some of cubes just wait on their places. What is wrong?
Position.x shoul be same for all (i cut on Z)
Thank you!