Add random number to position of object

Forum for: Modelling, Texturing, Animation, Composting and the whole general usage of Cinema4D.

Moderatori: Arkimed, natas, visualtricks, cappellaiomatto

Rispondi
  • Advertising
Benicarus
Messaggi: 2
Iscritto il: ven feb 21, 2014 11:33 am

Add random number to position of object

Messaggio da Benicarus »

Hello guys,

This forum already helped me with an xpresso problem. Thanks a lot for that. But now I have another issue, that keeps coming back. Let me explain:

I want a cube to be moved randomly after a certain amount of frames.

I set up an expression that gives out numbers after a certain amount of frames and plugs it into the x-coordinates of the cube.

The problem is, that it will only jump to the new position for the n-th frame and then jump back.

What I'm trying to achive is to generate a random number, then add that number to the current position of the cube and hold it there until I get the next random number after the n-th frame. I assume there's some programming involved? It seems like a loop, that doesn't work, if I need to take the x-pos from a cube to add it to a random number and plug it back into the x-pos of the cube. I need to find a way to get the position of the cube just for the n-th frame. Can anyone help me out on this?


Thank you guy for your help
Benjamin
Allegati
Random_position.zip
(53.37 KiB) Scaricato 107 volte
Avatar utente
cappellaiomatto
Moderatore
Messaggi: 1571
Iscritto il: lun mag 07, 2012 5:12 pm

Re: Add random number to position of object

Messaggio da cappellaiomatto »

Hi Benjamin
if I understand what you need in the attachment you will find the solution.
Just track the cube to the position of another object like a null

on the X th frame apply the random position.....in order to control the amount of x shift adjust the range mapper, it's more simple and easy to manage instead of a math division :)

PS
if you need to post a file zip it and use the attachment system of our forum in the future
Allegati
1.jpg
Random_position_2.zip
(61.99 KiB) Scaricato 137 volte
Benicarus
Messaggi: 2
Iscritto il: ven feb 21, 2014 11:33 am

Re: Add random number to position of object

Messaggio da Benicarus »

Awesome! Thank you so much for the help.

I'll check it out in a bit and let you know how it went.

Thanks again-
  • Advertising
Rispondi