writing to point attributes of arbitrary points

   2847   1   1
User Avatar
Member
27 posts
Joined: July 2005
Offline
I'm trying to get particles to bounce off each other using the Proximity POP, but no matter which way I turn I find I have the problem of writing to the point attributes of two particles from within the same function. This is because a collision needs to modify the velocity of both the collided particles.

At first I thought of using a custom expression function to modify the velocity of each point in a proximity group (using a Velocity POP) and using scripting to create a Velocity POP for each proximity group (since I don't know how else to loop through POPs). The problem is I need to write to the velocity attribute of an arbitrary point in addition to the current point. Is there some way to write point attributes as a function of point number or id?

Next I tried doing it in VEX. I had to use the SOP context (by way of a POP Merge SOP) because the POP context doesn't allow the import() function. The problem here is the same as with my custom expression function: each of the Npt calls to VEX operator writes to only one point at a time. It's no use to export a parameter to be used by a different VEX operator because I can only export attributes that are tied to the original id or ptnum–or am I wrong? It seems to me in order to make VEX work I would have to keep data around between calls using C++, but this is all new territory for me. Help?

Mike Anderson
User Avatar
Member
196 posts
Joined: July 2005
Offline
I haven't used the proximity pop yet so I cant help you there. I've had a few problems with the import function. Do you need it? Why not pass the attributes through the pop inputs? If this is crazy talk….

pop
myFunction( float x, vector a={0,0,0})
{
vector b=0;
b=a*x;
addattribute(“vectorb”,b);
}

..for example. x and a are attributes that already exist in houdini.

hope this helps.
h
Henster
  • Quick Links