Page 1 of 1

How can I use 'math.random' only for special keyframe?

PostPosted: Tue Sep 20, 2022 7:43 am
by ilia_t
I want to create random camera movement animation, using CornerPositioner. Can someone help me?

Screenshot 2022-09-20 174222.jpg
Screenshot 2022-09-20 174222.jpg (34.41 KiB) Viewed 537 times

Re: How can I use 'math.random' only for special keyframe?

PostPosted: Tue Sep 20, 2022 9:17 am
by Sander de Regt
What part isn't working for you? I'm not sure I understand the question.

Re: How can I use 'math.random' only for special keyframe?

PostPosted: Wed Sep 21, 2022 2:17 am
by ilia_t
Sander de Regt wrote:What part isn't working for you? I'm not sure I understand the question.

I want to create two keyframes. The first is on 0 frame and the second on 100 frame. I want to get random values of these keyframes and transpolation between them.

So each time when I play the video I'll get random camera movement.

Re: How can I use 'math.random' only for special keyframe?

PostPosted: Wed Sep 21, 2022 4:50 am
by John Holt
Hello

If you need the same sequence when you call math.random(), then you must set math.randomseed(same number every time before calling) before calling math.random().

If you want a different sequence of random numbers, then pass math.randomseed(os.time()) before calling math.random() because os.time() will return the time in number of seconds so it will be different every time.

John