Jump to content

accessing crowd's point attributes to add custom forces/velocity


ftaswin

Recommended Posts

Hi guys,

Is there any way to access point attributes in crowd setup to tweak the ragdoll behaviour?

popforce seems to break the whole thing and each agent is processed as a single point but somehow still able to run bullet sim in ragdoll state but with limited capability.

 

Thank you

 

C

Link to comment
Share on other sites

  • 1 month later...
s@name = "piece_" + itoa(@ptnum);
//Randomize Velocity
float x,y,z,minX,minY,minZ,maxX,maxY,maxZ,sx,sy,sz,sminX,sminY,sminZ,smaxX,smaxY,smaxZ;
//source min max velocity
vector min=chv("minVelRandom");
vector max=chv("maxVelRandom");
//randomize min max velocity
x = fit01(rand(@ptnum),min.x,max.x);
y = fit01(rand(@ptnum*222),min.y,max.y);
z = fit01(rand(@ptnum*333),min.z,max.z);
//assign the same to force which doesnt work
//v@force=set(x,y,z);
//assign the random velocity to each bone which worked for me
v[]@v_agent;
i@myBones= agenttransformcount(0, @ptnum);
for(int i;i<=@myBones;i++)
    {
    append(@v_agent,@force);
    }
//Initial Spin Random
vector smin=chv("minSpinRandom");
vector smax=chv("maxSpinRandom");
sx = fit01(rand(@ptnum*1000),smin.x,smax.x);
sy = fit01(rand(@ptnum*1222),smin.y,smax.y);
sz = fit01(rand(@ptnum*1333),smin.z,smax.z);
//assign Spin Random in Torque
v@torque=set(sx,sy,sz);

//Oscilation Setup
//In the below vex code the only value I have used in the simulation is the v@oscillation's Y component but the code also creates an array which is currently not being used


/*vector oMin         =   chv("oscillationMin");
vector oMax         =   chv("oscillationMax");
vector oRandom      =   fit01(random(@ptnum),oMin,oMax);
v@oscillation       =   oRandom;
v@zeroOscillation   =   set(0.0,0.0,0.0);

v[]@oscillation_agent;
i@myBones= agenttransformcount(0, @ptnum);
for(int i;i<=@myBones;i++)
    {
      
    if(i==30||i==32||i==1)
        {
        append(@oscillation_agent,v@oscillation);
        }
    if(i!=30||i!=32||i==1)
        {
        append(@oscillation_agent,v@zeroOscillation);
        }
    }
*/
//Create v_agent array and a vector array for oscillation of certain selected bone numbers

The above code will create some custom velocity for the agents in sop level and then later you can use the v[]@v_agent in a sop solver to copy to the particular agents you need to apply it to. So basically what we are are doing here is defining random velocity and torque to a certain number of bones in the crowd agents. You should feel free to bypass the codes that you do not need. I have already bypassed the oscillation bit of the code for you.

Cheers,

Manishkumar Makhija

Link to comment
Share on other sites

  • 7 months later...

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...