Is there a solution for considering a "mass" property for spherical agents?

39 views
Skip to first unread message

Jack Edwards

unread,
Jun 25, 2020, 6:54:19 PM6/25/20
to HAL Q and A
After looking through how some of the examples and documentation of the spherical agents, I found that their velocity is calculated by multiplying the ratio of the x or y component of the overlap distance to the total overlap distance by the force. The force is calculated from Hooke's Law where the spring constant is a parameter I feed into it. 

Here is some of the code from the SumForces function:

double[] info = displacementInfo.get(i);
double dist = info[0];
double xComp = info[1];
double yComp = info[2];
double touchDist = (radius + a.radius) - dist;
double force = OverlapFun.CalcForce(touchDist, a); //This line refers to an input parameter, which in my code is given as force = k * overlap
xVel += (xComp / dist) * force;
yVel += (yComp / dist) * force;

There does not appear to be any form of acceleration, which is likely why I can not find a mass property. I would like to have different types of the same agent react to the same force differently, which is why I thought to give them different mass properties so their motion would be different. If anyone can think of a way where I can make differentiated types of the same agent move differently under the same force calculation, I would love to hear it. I suspect giving them different values for the friction they experience may be the easiest solution, but I would very much appreciate some insight. 

Thanks!

Rafael Bravo

unread,
Jul 6, 2020, 12:41:46 PM7/6/20
to HAL Q and A
Hi Jack, If you make the overlap function a member of your cell class, then you can access the properties of the cell that you are calculating the force for, you can then modify the resulting force that will be applied to the cell based on these properties. Let me know if you still have trouble
Reply all
Reply to author
Forward
0 new messages