ianwww Posted October 8, 2020 Share Posted October 8, 2020 I've created a sphere primitive in vex, using: centre_pt = addpoint(0, pos); sphere_prim = addprim(0, 'sphere', centre_pt); I want to be able to vary its size in the viewport but can't work out how to do it. When a sphere prim is added using a SOP, the sphere's size can be changed using scale (the Uniform scale slider). I thought that this vex would therefore do the same thing: setprimattrib(0, 'scale', sphere_prim, chf('sphere_size'), 'set'); but changing chf('sphere_size') has no effect on the sphere's size. (I've also tried replacing 'scale' with 'radius', and also with 'radx', 'rady' and 'radz'.) I've found this link cgwiki which explains how to do it for a prim that has multiple points but a sphere prim only has its single central point. How can I change a sphere prim's size in vex? Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted October 8, 2020 Share Posted October 8, 2020 Hi Ian, set and scale a transform matrix: float scale = chf('scale'); vector pos = chv('position'); int pt = addpoint(0, pos); matrix3 xform = ident(); xform *= scale; int prim = addprim(0, 'sphere', pt); setprimintrinsic(0, 'transform', prim, xform); Quote Link to comment Share on other sites More sharing options...
ianwww Posted October 8, 2020 Author Share Posted October 8, 2020 Brilliant - that did it! Thanks Konstantin. I would never have worked that out by myself...! 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.