Jump to content

how to random rotating ?


Recommended Posts

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

Link to comment
Share on other sites

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

post-1272-125729780469.gif

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...