i have this script Code (JavaScript): var speed : float = 5.0; var maxheight : float = 898; var minheight : float = -898; function Update () { if( minheight <=-898) { transform.Translate(Vector3(0,speed,0) * Time.deltaTime); } else if( maxheight >= 898) { transform.Translate(Vector3(0,-speed,0) * Time.deltaTime); } } and the objects goes up but doesn't go down and im wondering if there is a way to make this work with more then one object and randomize the movement
I don't think comparing minheight and maxheight with fixed values is what you want. You should compare the object's actual position to minheight/maxheight They way you did it, the first condition is always true, so the object will always go up.
what would be the best why to do that as im trying different ways at the min and this is something im looking to get working as soon as