Particle Question:spriteTwist

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
  05 May 2003
Particle Question:spriteTwist

Hello, i am making an animation of some titles that blow away like dust or smoke. (the title and particles will be composited later in another program via an animated mask) The particles are rendering as sprites with a small smoke .tga applied. At the present moment they change their scale and opacity as I want, and I have them all being created with a random twist applied, so no two sprites look too similar

But i want to take it a step further. As the animation progresses, i want each sprite to randomly twist at a constant speed. To clarify, each sprite will rotate at a constant speed, but each sprites speed rotation and direction of rotation will be different and random. How would i do this?

BTW, this is just for a friends project, not a film or something so I dont want it to be a huge long process, a quick line of code with an explanation is all thats required.

Thanks a lot for reading!
Optional signature you may use to appear at bottom of your posts.
  05 May 2003
first you create two own attributes

myTwist (float - scalar)
myTwistPP (float - Per Particle)

and also create the build in twistPP;

creation expression :

myTwistPP = rand(-1,1) * myTwist;
twistPP = 0;

runtime expression :

twistPP += myTwistPP;

thats it. you can now adjust the twistSpeed by the extra attribute myTwist in the channelBox.
heimwerker never die
  05 May 2003
ok i will check this out and depending upon the result i get, i will choose whether or not to thank you for responding.

hehe im kust kidding, thanks for the help, im sure it'll work.

EDIT: do you mean spriteTwistPP instead of twistPP?

EDIT#2: It works perfectly, but i had to alter your expressions with the spriteTwistPP instead of TwistPP. Thanks a bunch, this is really cool!
Optional signature you may use to appear at bottom of your posts.

Last edited by Antilles : 05 May 2003 at 04:24 AM.
  05 May 2003
Talking This is asuming...

//This answer is asuming that you have a lifespanPP on your
//sprites. I can explain it without but it is much more involved.

//particle1 is the name I am using for this script.

//You need to create these PP array atributes

// holding
// holdTwist

// spriteTwistPP
// lifeSpanPP

//Note:make sure you hit the add propertes for this particle type
//button before you start these expressions

//First you need a random value that it is going to twist to
//over its lifespan.

$picker = ceil(rand(0,2));

if($picker ==1)
particleShape1.holding = rand(20,180);
particleShape1.holding = rand(-20,-180);

//This method of randommizing allows you to have a minimum
//amount of twist (this case 20 degrees of twist +-), keeps the
//value from being too close to or equal to 0
//this value can be tweaked for how much twist you want on them

//next the random initial twist

particleShape1.holdTwist = rand(0,180);

//next this sets the actual spriteTwistPP to the holding value;

particleShape1.spriteTwistPP = particleShape1.holdTwist;

//lifespan set to a random value between .5 and 1 seconds or 12
//to 24 frames

lifespanPP = rand(0.5,1);

//end Creation ==================


//this expression twists the sprite over it's life time the amount
//kept in the holding array

particleShape1.spriteTwistPP = particleShape1.holdTwist + (smoothstep(0,particleShape1.lifespanPP,particleSh ape1.age)* particleShape1.holding);

//It is twisted in a function curve with a slow out and in

//Hope this helps.


//I commented everything you should be able to basically
//copy and paste this post into the expresion editor
Make me believe, make me taste it with my eyes.
  01 January 2006
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 04:53 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.