Create downward vector along the surface

   866   2   1
User Avatar
Member
72 posts
Joined: March 2020
Offline
Hello magicians,

I'm trying to create a vector that goes along the surface of this donut and down into the hole. So far my Vex snippet is like this but the direction is not correct.

Can anyone point me in the right direction (pun intended)? Thank you.

Attachments:
Capture.JPG (131.4 KB)

https://huylefx.com/ [huylefx.com]
User Avatar
Member
8551 posts
Joined: July 2007
Offline
something like this?
vector up = {0,1,0};
vector out_dir = v@P - getbbox_center(0);

v@tangent = normalize(cross(out_dir, up));
v@tangent_up = normalize(cross(v@tangent, v@N));
Edited by tamte - March 5, 2022 20:40:22
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
72 posts
Joined: March 2020
Offline
tamte
something like this?
vector up = {0,1,0};
vector out_dir = v@P - getbbox_center(0);

v@tangent = normalize(cross(out_dir, up));
v@tangent_up = normalize(cross(v@tangent, v@N));

Thank you sir! I see where I missed.
https://huylefx.com/ [huylefx.com]
  • Quick Links