I am trying to "squeeze" a gameObject. When distance starts to be 6.98, execute this code: "The smaller the distance between gameObject1 and gameObject2, the thinner and longer this gameObject is". Somehow, this code has no effect. Why?
public Transform gameObject1;
public Transform gameObject2;
void Update ()
{
float distance_squeeze = Vector3.Distance(gameObject1.position,
gameObject2.position);
if(distance_squeeze < 6.98F)
{
transform.localScale = new Vector3(-distance_squeeze, distance_squeeze, 1);
}
}
if
condition met at all? \$\endgroup\$