CinnamonMetal Posted May 21, 2018 Share Posted May 21, 2018 (edited) int chngePrim = detail(1,"iteration",0); if(chngePrim%2==0){ v@Vector_Pt_AC = prim(0,"Vector_Pt_AB",chngePrim) - prim(0,"Vector_Pt_AC",chngePrim)/1; setprimattrib(geoself(),"Vector_Pt_AB",chngePrim,@Vector_Pt_AC,"set"); v@crossPro = cross(prim(0,"Vector_Pt_AC",chngePrim),(0,1,0)); } Why is my cross product attribute not being created ? Edited May 21, 2018 by CinnamonMetal Quote Link to comment Share on other sites More sharing options...
ikoon Posted May 21, 2018 Share Posted May 21, 2018 Hi, try to define the up vector like this: set(0,1,0) or {0,1,0} Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted May 22, 2018 Author Share Posted May 22, 2018 48 minutes ago, ikoon said: Hi, try to define the up vector like this: set(0,1,0) or {0,1,0} Either of those don't work Quote Link to comment Share on other sites More sharing options...
toadstorm Posted May 22, 2018 Share Posted May 22, 2018 are you sure the attribute is being created in the place you think it's being created? looks like you're running a detail wrangle, but you're trying to create that cross attribute per-primitive, and that won't work. you'd have to create the cross attribute as a prim attribute ahead of time, then use setprimattrib() to set it. Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted May 22, 2018 Author Share Posted May 22, 2018 If I create the cross attribute ahead of time, otherwise in a primitive wrangler before the detail wrangler; there are variables in the cross attribute that are not available until the detail wrangler which comes after the primitive wrangler for which the cross attribute was created ? If I use the cross attribute within the primitive wrangler (the wrangler before the detail wrangler) the cross function doesn't accept variables other wise I would be able to set the cross attribute, you know what wrangler I'm referring too If not it's the wrangler before the detail wrangler Quote Link to comment Share on other sites More sharing options...
acey195 Posted May 23, 2018 Share Posted May 23, 2018 On 5/22/2018 at 1:39 AM, CinnamonMetal said: int chngePrim = detail(1, "iteration" ,0); if(chngePrim%2 == 0){ v@Vector_Pt_AC = vector(prim(0, "Vector_Pt_AB", chngePrim)) - vector(prim(0, "Vector_Pt_AC" ,chngePrim))/1; setprimattrib(0, "Vector_Pt_AB", chngePrim, v@Vector_Pt_AC); v@crossPro = cross(vector(prim(0,"Vector_Pt_AC",chngePrim)), set(0,1,0)); } Why is my cross product attribute not being created ? if you are doing more than one operation per line, always hard cast your variables, otherwise they will be considered as a float in some cases. This is especially true for functions that accept multiple data types. side topic, the {0,1,0} notation does not accept variables, so use set(0, x, 0) instead if you need to Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted May 24, 2018 Author Share Posted May 24, 2018 @acey195 I'm still not able to see the @crossPro attribute with a visualizer ? Could it be explicitly casting a float to a vector doesn't work ? Quote Link to comment Share on other sites More sharing options...
ThomasPara Posted May 24, 2018 Share Posted May 24, 2018 it seems like your running in a for-each loop, is it a per-primitive operation? If so your primnum will allways be 0 inside the loop. I would also break this line up into: v@Vector_Pt_AC = vector(prim(0, "Vector_Pt_AB", chngePrim)) - vector(prim(0, "Vector_Pt_AC" ,chngePrim))/1; I will ignore the /1, because im not sure what that is doing here. vector AB = prim(0,"Vector_Pt_AB",0); vector AC = prim(0,"Vector_Pt_AC",0); v@Vector_Pt_AC = AB-AC; This will only work if your v@Vector_Pt_AC exist from before, or else you would only have an empty vector. It would be easier to understand your solution if we know what your goal is, because i think this can be done in a mutch more efficient and easier fashion 1 Quote Link to comment Share on other sites More sharing options...
CinnamonMetal Posted May 24, 2018 Author Share Posted May 24, 2018 (edited) Thanks. Edited May 30, 2018 by CinnamonMetal 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.