View Full Version : particle/goal expression
im trying to calculate out the distance between each particle on a soft body and the goal its moving towards, and i have no idea how to do this... any idea?
|
|
'tssup Dann, well I'm not sure of what exactly you are trying to do so if you gimme some more info I might be able to help you.
I can only guess.
You can calculate particle position by entering in the component editor, get a given position of one particle, calculate the position it will take based on the an arbritary value that you specify of the goalU and goalV combined with the goal offset if you decide to use it. An example:
If the attributes don't specify a valid position on the object, the closest position on the surface or curve is used as the goal position instead. A position is invalid if it is out of the object's U and V range or it's on a part of the curve or surface that you've trimmed. To ensure the closest point is used, specify a value of
-1.
Why do you need to calculate distances or what are you trying to achieve with this?
i need to be able to calculate the distance between a particle on a soft body and the clsoest point on it's goal. So the particle has to look at where it is in space and then compare to the closest point on the goal object. This has to be possible, im just not sure how. And i need to be able to calculate this as an expression because this distance is going to drive other attributes as well.
artifish
10-17-2002, 03:53 PM
hi,
some suggestions that might work:
create a locator "cpLoc" (closestPointLocator), create a closestPointOnSurface node "cpos", connect the cpLoc's world position (wp) to the cpos's inPosition, connect the goal surface's world surface to cpos's input surface.
now write a particle expression that moves cpLoc to the position of the current particle (use the particle worldPosition attribute) and the move mel command. get the position of the nearest point to the particle by querying the cpos.result.position attribute.
subtract the result.position from the particles worldPostion and the length of the resulting vector is the distance you are looking for.
does this solve your problem?`
yeah that did, aite thanks a lot you guys. Got the script finished so that every particle checks against every vertex on a polygonal goal and sees what the closest distance is.
TRi-14
10-19-2002, 09:28 PM
expressions....mmmmm
CGTalk Moderation
01-13-2006, 07:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.