Quantcast
Channel: Answers by "Kleptomaniac"
Viewing all articles
Browse latest Browse all 90

Answer by Kleptomaniac

$
0
0
In order to randomly affect the x and y travel direction of your pellets, instead of having `Vector3(0, 0, speed) * Time.deltaTime`, try using [Random.Range][1]. So therefore: `Vector3(Random.Range(minx, maxx), Random.Range(miny, maxy), speed) * Time.deltaTime` where minx and many are your minimum x and y translation vectors, and maxx and maxy are your maximum x and y translation vectors. Random.Range will choose a value between those values and apply that to your Vector3, thus giving you random pellet spread. :) Hope that helps, Klep [1]: http://docs.unity3d.com/Documentation/ScriptReference/Random.Range.html

Viewing all articles
Browse latest Browse all 90

Trending Articles



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