- Home /
Question by
aclee · Sep 30, 2014 at 02:16 PM ·
javascriptterrain
procedural terrain
hi, i wrote a JS script that randomly generates a cubic terrain using perlin noise and i have a few questions:
how would i make the height differences between cubes static? (i will all ways be the same)
Comment
Answer by stulleman · Sep 30, 2014 at 02:49 PM
You mean a seed? Simple!
Random.seed = Random.Range(int.MinValue, int.MaxValue);
// if 2d
offset = new Vector2(Random.Range(0, 10000), Random.Range(0, 10000));
// or this if 3d
offset = new Vector3(Random.Range(0, 10000),Random.Range(0, 10000),Random.Range(0, 10000));
So when you always put the same seed in Random.seed the offset will always be the same. When you get your data from the perlin noise just add the offset to your coordinates.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Cube terrain with perlin noise 1 Answer
rigidbody.AddForce to another object 2 Answers
Dreaded UCE0001 ';' error 2 Answers
(Unity pro) Can't find terrain settings 0 Answers