Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
spectronaut

vex RaySOP behaving differently than VEX intersect()

I have a RaySOP that is doing exactly what I want. It is shooting rays per point along a direction defined by point attribute 'rdir' and is returning the hitprims I'd expect. Hitprims are the green numbers in the images below, yellow lines are visualisation of attribute 'rdir' (raySop shown below)


 raySOP.jpg

 

I want to be better about doing things with VEX so I tried doing the same thing with the same set of points, with the same 'rdir' attribute and same collision geo. I get wildly different results for my hitprims as shown below.
heres the tiny bit of VEX I've got: 

vector p;
vector hitprimuvw;
vector dir = @rdir;
int hitted;

hitted = intersect(1, @P, dir, p, hitprimuvw);
@hitprim = hitted;

vexIntersect.jpg

 

What am I missing?

Share this post


Link to post
Share on other sites

2 things

when you reference your own attributes for the first time in a wrangle you need to declare the type

  v@rdir instead of @rdir, which actually evaluates to (@rdir.x, @rdir.x, @rdir.x)

and then the length of the direction function parameter dictates the max distance that the ray can look for collisions, so in this case you need to multiply it by some scalar so that it can travel far enough to reach your obj. 

 

1 person likes this

Share this post


Link to post
Share on other sites
14 minutes ago, dchow1992 said:

2 things

when you reference your own attributes for the first time in a wrangle you need to declare the type

  v@rdir instead of @rdir, which actually evaluates to (@rdir.x, @rdir.x, @rdir.x)

and then the length of the direction function parameter dictates the max distance that the ray can look for collisions, so in this case you need to multiply it by some scalar so that it can travel far enough to reach your obj. 

 

Yep works now, I knew about the vector length being trace distance (also realize in this example the vector was too short :p) BUT.... I was not aware of the v@derpyderp, good to know. Thank you much.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0