- Home /
Question by
EncryptedCow · Apr 21, 2013 at 12:16 AM ·
javascripttransformtransform.positionpositioningy axis
Changing water level
I have a pool of water using the daytime water prefab. I'm trying to make a script that slowly changes the water level depending on the weather and am stumped as to how to do this. So far I've got
function Update() {
if(weather == "partly cloudy") {
if(transform.position.y != 33.00) {
}
}
if(weather == "cloudy") {
if(transform.position.y != 35.00) {
}
}
if(weather == "raining") {
if(transform.position.y != 37.00) {
}
}
if(weather == "sunny") {
if(transform.position.y != 31.00) {
}
}
}
But from there, I have no clue how to actually make it go to the preferred position. Any help would be greatly appreciated.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613100723im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Alternative to using transform.translate and transform.position for moving objects exact values? 1 Answer
Script causing huge lag 0 Answers
Transform.position not working ??? 0 Answers
Finding an objects position from one canvas to the other 1 Answer
I did something wrong with my running script...the player is not bobbing when running? 0 Answers