Jump to content

how to scale pscale to 0 in dops based on distance ?


MadMax50

Recommended Posts

Hey everyone,

I want my RBD sim to scale to 0 when it gets close to an object in DOPS and stay at 0 pscale regardless of the object animation later on . The problem is that to sphere moves at the end and the pscale goes back to normal. How can I make the RBD pscale stay 0 . I am using a min function to try and help me but I am doing  something wrong.  I thought the sop solver was supposed to remember the previous frame. Someone please help ? Thank you

pscale_dist_sopSOlver.jpg

sop_solver_pscale_based_On_dist.hip

Link to comment
Share on other sites

Posted (edited)

Hi,

@dist attribute is calculating by ray sop and @pscale is overriding by remapped @dist each timestep. "IF" condition only works when @pscale < 0.1 so @pscale has a value from 1 to 0.1 then back from 0.1 to 1.

To make your setup work you have to set @pscale = 1 in SOP on packed geo before simulation and use this code in the attribute wrangle inside Sop Solver DOP:

float pscaleNew= fit(@dist, 0, ch("max_distance"), 0, 1);
@pscale=min(@pscale,pscaleNew);

if(@pscale<0.1) @pscale=0.1; 

 

Edited by vicvvsh
  • Thanks 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

×
×
  • Create New...