Jump to content

Expression Question


Recommended Posts

hello. i have a quick question - i'm trying to create an expression that qould rotate my object to 45 degrees or one of it's multipliers. it was fairly easy to create one, which rotates the object every frame:

int(rand($FF)*10)*45

but how would i make the new value being generated every 30 frames, for example? i was experimenting with using modulus, but no luck so far. does anyone know?

thanks a lot,

luka

Link to comment
Share on other sites

hey lukich,

your problem is in the rand.. you are still generating a random number (0 to 1) every frame...

this should get you where you want to be (with the "30" in "$F/30" being how often, in frames, it randomizes)

int(rand(int($F/30))*10)*45

Link to comment
Share on other sites

Have you tried

int(rand($FF%30)*10)*45

17294[/snapback]

the modulus here is good for creating a loop of the same 30 randomizations over and over again, but will still generate a value every frame.. this is because $FF%30 alone is a different number every frame in itself..

Link to comment
Share on other sites

the modulus here is good for creating a loop of the same 30 randomizations over and over again, but will still generate a value every frame.. this is because $FF%30 alone is a different number every frame in itself..

17296[/snapback]

Whoops, misunderstood the question. sorry.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...