About goalWeightPP

Become a member of the CGSociety

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

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2011
Question About goalWeightPP

I have one particle object and collise and goal with two objects, and I want when one particle collision with one object then goal with it, How can I do this?
 
  03 March 2011
I don't understand.
Try to make it more clear , maybe with some illustration showing your problem.
 
  03 March 2011
I think I get what you want.

Particles, called 'ps', are flying along and are going to collide
with something. 'Sphere' or 'Torus' is in the path of the particles.

a) Create a sphere
b) Create a torus
c) Create a particle system - named 'ps'
d) make the sphere a goal for 'ps'
e) make the torus a goal for 'ps'

now if you playback and have the two object separated, the particles will fly between them.

f) make the goalWeight 100% as it will be a multiplier

select the particle and in the attribute channel box:
goalWeight[0] = 1
goalWeight[1] = 1

g) make the particle system collide with both objects.

Now try something easy:
if the particles hit the sphere turn RED.
if the particles hit the torus turn GREEN.

For this you need to add PP attributes to the ps system
1) rgbPP - color PP button
2) Add general PP attribute: collisionGeometryIndex

Add Runtime before dynamics expression:

if(collisionGeometryIndex==0) // This is the sphere - set to collide first
rgbPP=<<1,0,0>>;

if(collisionGeometryIndex==1) // This is the torus - set to collide second
rgbPP=<<0,1,0>>;



So, now if you play back and scale up the 2 objects in the scene, the particles will bounce and change from black to a color - if your BG color is black you will only see the particles once they bounce!

Now it is working, making the particles become a goal for each object should be straight forward:

1) add goalU, goalV, collisionU/V and goalweight0PP/goalweight1PP to the particle system:

modify the expression above:

// check for a collision
//
if (collisionU != -1){
goalPP = 1;
goalU = collisionU;
goalV = collisionV;
}
if(collisionGeometryIndex==0){
rgbPP=<<1,0,0>>;
goalWeight0PP = 1;
goalWeight1PP = 0;
}
if(collisionGeometryIndex==1){
rgbPP=<<0,1,0>>;
goalWeight0PP = 0;
goalWeight1PP = 1;
}

Make sure that in your creation you zero out your PP weights:

goalPP = 0;
goalWeight0PP = goalWeight1PP = 0;


Have fun!

Xsiv
 
  11 November 2011
I'm trying to do something similar.
I have particles running through a volume axis field, and when they exit, I want them to stick to a goal. I have an expression to measure the distance between the particles and the goal, but as soon as the first particle get within that distance, the goal weight is set to 1 for all the particles and they all snap to the goal. Anyone know what's wrong?
I initialize the goal strength to 0 w/a creation expression
Thanks.
vector $goal0Pos=forensicsParticleShape.goalWorldPosition  0PP;// Get the WPos of each goal for each particle
 vector $pos=forensicsParticleShape.position; // the particle's positionPP
 
 // When the particle is close to the goal (out of the volume axis), set the goal weight to 1:
 if (abs($pos-$goal0Pos)<0.4) forensicsParticleShape.goalWeight0PP = 1;
__________________
If animation couldn't change the world, it wouldn't be such a Micky-Mouse place.
 
  11 November 2011
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 08:30 AM.


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