|
I would like to Smooth the Is there any way to do this using a This is for creating lightning in the Linerender component that gradually shifts from one random to another. -- FPSyndicate
(comments are locked)
|
|
Ah, what you're looking for is the Perlin noise function. If only you'd had that notion about 15 years ago, it could have been you accepting the Academy Award for Technical Excellence! You can find a C# class implementation in the "Procedural Examples". There are 1D, 2D and 3D versions. Basically, you use some smoothly varying input (like Mathf.Sin), and it gives you a smoothly varying random output. A key feature is that for a given input, you always get the same output. Thakns! i have the procedural examples, and was trying to replicate their lightning using the line renderer, ill try that!
Jun 07 '11 at 05:28 PM
FutchProductionsSyndicate
Are there any tutorials on how to implement the perlin noise? because i have the C# Class, but it won't allow me to add the script to my gameobject.
Jun 07 '11 at 06:43 PM
FutchProductionsSyndicate
No, you can't add Perlin as a component to your game object because it doesn't derive from MonoBehavior. But that is ok, because you can just add it as an instance variable and use it in your current Update() method. That is what Start() or Awake() is for: to perform more complex initialization of your game object that doesn't happen by default. There is no reason to make Perlin a component because it is part of the implementation of your game object. It is better to hide such details behind the class abstraction. So you want something like: private var Perlin:perlin = new Perlin();
Jun 07 '11 at 06:56 PM
hellcats
Jun 07 '11 at 07:19 PM
Joshua
(comments are locked)
|
|
This is a simple solution, hope it may help you. Swings the number smooth between 0 and 1 at a rate defined by slope, and changes swing direction at random intervals defined by interval or at the limits 0 and 1. Adjust slope and interval to get the desired results.
(comments are locked)
|
