Operating system or device, Godot version, GPU Model and driver (if graphics related):
Issue description:
Only providing one scalar in [0, 1] in random fields, is a bit limitating (for example with particles).
I think random should not be clamped so we can get a random value around ( not clamped) the initial one .
Now we can only have a value between initial and 1 (with random to 1 or even a lesser range with random < 1).
Steps to reproduce:
Link to minimal example project:
randf() * N would give a random float from 0 to N
edit: not sure if that's what you mean
I mean something like that (for example on particle scale) :
https://github.com/matrem/godot/commit/02d0d698b1606246253027432431b02e01a6e4ed
So I can set my scale to X and then configure its randomness in [X-R, X+R] (instead of [X, 1]).
I know that we can do what we want converting the particles materials to shader material, but I think the default particles material should get basic users more possibilities.
The randf_range function is fixes this issue ? cc @akien-mga
@Chaosus this issue is about CpuParticles/ParticleMaterial, not the Random class.
Ah.. right
Maybe the *_random properties could be changed to add/remove a random offset with the specified value. For example, if the *_random property was set to 1, the old behaviour could be restored by halving the property and setting the *_random property to the same value.
This means that if initial_velocity is 200 and initial_velocity_random is 50, it would have to be read as "200 卤50" (which is [150; 250]). Random values that exceed logically possible values (such as going below 0 for a property that only accepts values above 0) would likely have to be clamped.
This would break compatibility, so it will have to be done for 4.0.
I'll just link here to make it part of the discussion in the GIP:
godotengine/godot-proposals#815
Superseded by godotengine/godot-proposals#815.
Most helpful comment
Maybe the
*_randomproperties could be changed to add/remove a random offset with the specified value. For example, if the*_randomproperty was set to 1, the old behaviour could be restored by halving the property and setting the*_randomproperty to the same value.This means that if
initial_velocityis 200 andinitial_velocity_randomis 50, it would have to be read as "200 卤50" (which is [150; 250]). Random values that exceed logically possible values (such as going below 0 for a property that only accepts values above 0) would likely have to be clamped.This would break compatibility, so it will have to be done for 4.0.