kuaile_yzh Posted October 30, 2009 Share Posted October 30, 2009 I want to make a particle moving randomly in the range of (-pi/9, pi/9) on a sphere, but the result I get is rotating around X axis, Is there anyone could help me with it? Thanks. #include "math.h" pop testpop() { vector myP = normalize(P); float myrand = fit(random(Time),0,1,PI/-9,PI/9); matrix myident = ident(); matrix myrot = rotate(myident,myrand,myP); vector myD = normalize(cross(v*myrot,myP)); P = normalize(P+myD*3)*30; } rotation.hipnc Quote Link to comment Share on other sites More sharing options...
kuaile_yzh Posted October 31, 2009 Author Share Posted October 31, 2009 (edited) There is a sample click the picture to play animation Edited October 31, 2009 by kuaile_yzh Quote Link to comment Share on other sites More sharing options...
kuaile_yzh Posted November 4, 2009 Author Share Posted November 4, 2009 I want to make a particle moving randomly in the range of (-pi/9, pi/9) on a sphere, but the result I get is rotating around X axis, Is there anyone could help me with it? Thanks. #include "math.h" pop testpop() { vector myP = normalize(P); float myrand = fit(random(Time),0,1,PI/-9,PI/9); matrix myident = ident(); matrix myrot = rotate(myident,myrand,myP); vector myD = normalize(cross(v*myrot,myP)); P = normalize(P+myD*3)*30; } the problem seems be solved. Here is the new code: #include "math.h" pop testop() { vector myP = normalize(P); float myrand = fit(random(Frame),0,1,PI/-9,PI/9); matrix myrot = ident(); myrot = rotate(myrot,myrand,myP); vector myV = normalize(cross(v*myrot,myP)); v *= myrot; P = normalize(myP*20+myV) *5; } but still has a long way to go till the final result 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.