HI,
Just starting to have a play with the graph editor.
i want to create 2 random numbers, so i made 4 constant/real nodes, 2 minimum value 2 maximum value
i cant find a way to take each pair (min/max) and output a random number within the min/max range.
how can this be done?
cheers.
Dave.
Random Numbers
Re: Random Numbers
It goes like this. Lets say you want a rand from 2-6:
type 2+rnd(4) (The sum of 2 and a random number between 0 and 4)
Hope that helps.
type 2+rnd(4) (The sum of 2 and a random number between 0 and 4)
Hope that helps.
-
- Posts: 78
- Joined: Thu May 30, 2013 1:19 pm
Re: Random Numbers
Hey CG_Nema,
To be honest that doesn't help
I needed to know the correct node's to use in the graph editor and have since found (i think) the one i need - "ArrayNumRandom"
that outputs two sets of random numbers, i just need to know how to plug these values into a null's x and y position now
Replies are like gold dust on this forum, so thankyou for yours
Dave.
To be honest that doesn't help
I needed to know the correct node's to use in the graph editor and have since found (i think) the one i need - "ArrayNumRandom"
that outputs two sets of random numbers, i just need to know how to plug these values into a null's x and y position now
Replies are like gold dust on this forum, so thankyou for yours
Dave.
Re: Random Numbers
Got it sorry I thought you were doing it with the curve editor, I skimmed through your post a little too quickly .
I would recommend you do it the way I explained with the curve editor, the only reason you should do it with graphs instead would be if you want the node's value to change per-step because the rnd() expression in the curve editor will only choose and new rand per frame.
If you want it to change per-step then go ahead and do it with the graph like this:
Use the "SetNodeParameter" graph node.
Plug in the the node and connect the random number to the "number value" input.
And for the parameter, when its a vector parameter, like a position, you can type "position.x", "position.y", or "position.z".
This should be more helpful than my previous post .
Edit:
Scratch that, I don't think it's going to work because the "seed" on the random number array is always the same so the random number it spits out is always the same. Maybe I did something wrong there, but if you can get a different random number every time you run the graph than the "SetNodeParamter" node should still work for you.
I would recommend you do it the way I explained with the curve editor, the only reason you should do it with graphs instead would be if you want the node's value to change per-step because the rnd() expression in the curve editor will only choose and new rand per frame.
If you want it to change per-step then go ahead and do it with the graph like this:
Use the "SetNodeParameter" graph node.
Plug in the the node and connect the random number to the "number value" input.
And for the parameter, when its a vector parameter, like a position, you can type "position.x", "position.y", or "position.z".
This should be more helpful than my previous post .
Edit:
Scratch that, I don't think it's going to work because the "seed" on the random number array is always the same so the random number it spits out is always the same. Maybe I did something wrong there, but if you can get a different random number every time you run the graph than the "SetNodeParamter" node should still work for you.
-
- Posts: 78
- Joined: Thu May 30, 2013 1:19 pm
Re: Random Numbers
No worries
I am only doing it this way to get some experience of the graph editor, and i do want this to change per frame so i will go with the curve editor method for now.
cheers.
Dave.
I am only doing it this way to get some experience of the graph editor, and i do want this to change per frame so i will go with the curve editor method for now.
cheers.
Dave.
-
- Posts: 32
- Joined: Thu Jan 05, 2012 11:49 pm
Re: Random Numbers
These are the graph nodes you might be interested in:DeltaJuliet wrote: that outputs two sets of random numbers, i just need to know how to plug these values into a null's x and y position now
*Conversion/Vector3FromComponents
*Scene Node/GetObject
Scene Node/GetTransformation
*Scene Node/SetTransformationFromComponents
Math/Add
the * ones will get you exactly where you want to be 'now': GetObject to fetch the null, Vector3From... to create a vector from your random numbers, SetTransform... to set the position vector of your null. You should be able to figure out the connections needed. Using the other nodes you could move the object relatively instead of absolutely.