Jump to content

Curve collision


Recommended Posts

Hello magicians,
i'm trying to do a curve collision in VEX, using volume sample and volume gradient for calculating collisions.
i would like to understand how implement the original curve restlength in my VEX code, as you can see of course the curve stretch until now.
Any suggestion, link, idea ?

Thanks in advance


Link to comment
Share on other sites

Hi Reyan,

if you search for volume sample in the forum you will find good explanations about these vex functions and how they operate , 

dont know if understood your question right ,

from what i understand ,

distance to the point = volume sample,

and the gradient calculates the direction towards the point,

to get the curve collision, your code could be reduced to this ,

float volume_sample = volumesample(1,0,@P);
vector volume_gradient = volumegradient(1,0,@P);
if(volume_sample <= 0)
@P -= normalize(volume_gradient)*volume_sample;

and the if you plug the ray sop , it does the same thing






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.

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...