Thread: rain splotches
View Single Post
# 4 16-07-2004 , 11:38 AM
Alan's Avatar
Moderator
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
ok success but looking back at yoiur post it's maybe not exactly what you wanted. But it's pretty cool anyways and it should show you roughly how to orientate the particles to the plane.


1. create a particle emitter.
2. create a small nurbs plane (to be instanced) and a large one (to collide with). Deform the big on e a bit so you can see this in action.
4.create some gravity for the particles.
5. make the large plane and the emitter collied together.
6.instance the small plane onto the particles.
7. add the collisionU and collisionV particle attributes. Add two more vector attributes (per particle arrays) one called normal and one called inverseNormal. These are th normals of the point of collision.

8. put this expression on the particleShape


//CODE---------------------------------------
//object to collide with
string $obj = "nurbsPlane2";

//dont really need to do this but it's easier
float $cV = particleShape1.collisionV;
float $cU = particleShape1.collisionU;

//when collision occurs these values change so only do the next bit when they do!
if($cU != -1 || $cV != -1)
{
//build up our pointone surface command. Which will return the xyz of the uv collision point
string $tmp = "pointOnSurface -u "+ particleShape1.collisionU +" -v "+ particleShape1.collisionV +" -position nurbsPlane2";
//eval it
float $collInfo[] = eval($tmp);

//build up another command to do the same for the normal
$tmp = "pointOnSurface -u "+ particleShape1.collisionU +" -v "+ particleShape1.collisionV +" -nn nurbsPlane2";
//eval it
float $iNormal[] = eval($tmp);

//assign the values to the vector attributes created earlier
particleShape1.inverseNormal = <<$iNormal[0] * -1, $iNormal[1] * -1, $iNormal[2] * -1>>;
particleShape1.normal = <<$iNormal[0], $iNormal[1], $iNormal[2]>>;
}
//CODE---------------------------------------

9.set the particle instance options in the particleshape to be

aimdirection: iNormal
aimAxis: normal

10. Hit play... it's should work. user added image

check out the attatched scene file to see it working

post again if it doesnt work.

Alan


My guess is no one here will know either, but I figured it was worth a shot.

oh ye of little faith!!! user added image

Attached Files
File Type: mb test_run.mb (50.2 KB, 268 views)

Technical Director - Framestore

Currently working on: Your Highness

IMDB