Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Sin function returns NaN

$
0
0
I'm trying to figure out why this function is returning a NaN value for v3.y. The object of the script is to move the "centerPoint" up and down using the sin. Whenever the script runs from the beginning of the scene this code throws a NaN error. However if I enable the script after the scene is run it works without throwing an error. I'm guessing it may be because centerPoint starts at 0, but I am not sure. Seeking guidance and help! Vector3 v3 = centerObject.localPosition; v3.y = Mathf.Sin(Time.time * _frequency + phase + (centerPoint / width)) * amplitude; centerObject.localPosition = v3;

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>