How can I just do some random particle motion(conveniently) for particles....I mean I can always do something stupid like look up a random number from a list, but.....

I don't understand why I cannot use "randf_range()"...

help! please ;)

wait...only for reference objects...WTH? sometimes this engine feels so backwards I want to shoot myself...

*after a long sigh....

Does anyone know a single line of code that I could use to set a random vector to use for particle gravity?

I can set the gravity and everything, I just cant use any of the random functions that I find useful for this case.

ok, I figured something out, using it like a tool, but I need to create a new RandomNumberGenerator for each coordinate(XYZ)....this seems superfluous...

is there a better way?

If you only need a single random number, you might be able to use a uniform and then pass the random number through GDScript/C#. It is not ideal, but it might work in a pinch.

Another interesting solution to generating random numbers could be using something like the random function provided in the "2D Random" section of this page from the BookOfShaders.com. If I recall correctly, the shader shown works in Godot with a little modifying, though I found passing the Vector2 to get the number difficult. It might be worth looking into if you have a way to generate Vector2 coordinates.

It is strange that randf_range is not defined. I'll keep an eye out for other solutions and if I find any, I'll post them here.

well I'm using spatial(3D) but I can use them(the methods) with...

var some_var = RandomNumberGenerator.new()
var num : float
some_var.randf_range(-num,num)

EDIT: below I don't mean each vetor, I mean each index for a Vector3. but I have to do this for each vector...I'm certainly not a shader programmer...

I may be doing this all wrong for what I am trying to achieve, now that I've had more time to think. I would probably be better off using a multimesh instance to create particles, but I don't know if that supports transforms...I'm sure it does...

I believe you can pass Transforms and an index for each MultiMesh node, if I remember from my experiments with the node. According to the documentation, you can use the set_instance_transform function, which sounds right from what I remember.

sorry for all the questions...BUT...can this also handle removing them, or can I attach a script to them(then I could give them a "life time" property)...

A really hacky particle system is what I am thinking....

No worries about the questions! I might not know the answer, but I have no issue at all with questions being asked.

From what I remember, there is no great way to remove instances in a MultiMesh node. If I remember correctly, what I did to work around this issue was set unused/dead instances to have a really small scale (like 0.01 if not just 0) and I placed them at a coordinate I was fairly sure would never be visited (like Vector3(-1000, -1000, -1000)). That said, there might be a way to remove instances and I just missed it.

3 years later