pop target pops to orientation and position

Recommended Posts

hello guys!

I have a pop sim that runs for like 30 frames as they fall .. then I want to revert(attract?!) them back to their initial position (as they were before falling)... I tried the per point attract on the attract node.. and I get their positions back .. how can I get their orientation also to be targeted to the initial orientation?

Share on other sites

Cache it out and play it in reverse? You can play around with a per point time offset using for-each loops, check out CGWiki!

Another way would be to use a VOP and interpolate between the point's current position/orientation and a rest position/orientation.

Edited by brassmonkey
Share on other sites

If you want to simply revert to the original orientation without applying forces, you can do this post-sim by blending your original orient before the sim (save the starting orientation of your particles to a vector4 attribute) and then interpolating that orientation with the current orientation:

`p@orient = slerp(p@orig_orient, p@orient, bias)`

where bias is a value from 0-1.

If you want to apply this as a force via a POP Wrangle, you'd have to figure out the amount of spin necessary to rotate from your current orientation to the goal orientation. You could then assign that to v@torque, or using wind-like spin forces via v@targetw and f@spinresist. The math for this gets a bit... complicated.

First, you want to compute the delta between your current orientation and the goal orientation. You can do this by multiplying your goal orientation by the inverse of the original orientation:

`vector4 delta_orient = qmultiply(goal_orient, qinvert(p@orient));`

However, in order to avoid a situation where the delta is computed as being a greater than 180-degree difference due to the nature of quaternion rotations, which would cause wild flipping behavior, you'd need to compute the dot product of your goal and current orientations and negate one of the quaternions if this is the case:

```vector4 current_orient = p@orient;

if(dot(goal_orient, current_orient) < 0) {

current_orient = -current_orient;
}
vector4 delta_orient = qmultiply(goal_orient, qinvert(current_orient));```

Now you can convert this quaternion to an axis/angle representation of a quaternion, which is how the v@torque and v@targetw attributes work:

`v@torque = qconvert(delta_orient) * chf("spin_force");`

The "spin_force" channel would modulate the amount of torque you're applying so the parts don't oscillate too much around their goal orientation. If you want the particles to ignore their mass attribute when doing this, just multiply v@torque by f@mass.

• 2
• 2
Share on other sites

thank you so much for this! @toadstorm <3

Share on other sites

nice job @toadstorm! I was looking into this myself but my solution was about transporting N and up with the sim. Was wondering how to do it with quaternions!

Edited by nuki

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×