spectronaut Posted May 9, 2017 Share Posted May 9, 2017 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) 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; What am I missing? Quote Link to comment Share on other sites More sharing options...
spectronaut Posted May 9, 2017 Author Share Posted May 9, 2017 heres a simplified hip file to illustrate my issue. How do I get the VEX to function like the raySop? rayVSintersect.hip Quote Link to comment Share on other sites More sharing options...
dchow1992 Posted May 9, 2017 Share Posted May 9, 2017 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 Quote Link to comment Share on other sites More sharing options...
spectronaut Posted May 9, 2017 Author Share Posted May 9, 2017 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.