Hi i am trying to move a cube in only horizontal way , Horizontal axis in my case is Z ,
when player clicks on character that moves in horizontal axis , i save his position and when player does 2nd click on the screen i save that variable too .
Now i am doing
if (this.gameObject.transform.position.z - targetPosition.z == 0) {
print("say hi ");
}
but its not working
when i try to print values of both z positions i get same number :
12.50797
print (this.gameObject.transform.position.z);
print (targetPosition.z);
but if i do
print (this.gameObject.transform.position.z - targetPosition.z);
i get wierd number :
-9.536743E-07