67 lines (53 with data), 2.6 kB
#class_template ConditionalContactClass (AnyRefFrame &BaseObject, AnyRefFrame &TargetObject, DisplayTriggerVolume, DisplayTargetNode)
{
AnyRefFrame &StrengthObject=TargetObject; //Node used for strength measurement, occasionally this is different from the target object
AnyFolder &DrawRef=Main.DrawSettings; //reference to the folder which contains drawsettings
//low limit for the strength measure function, if the distance measured along Direction[0] is below this val. the strength will be zero (negative)
#var AnyVar UserDefinedLimitLow;
//high limit for the strength measure function, if the distance measured along Direction[0] is above this val. the strength will be zero
#var AnyVar UserDefinedLimitHigh;
//high limit for the strength measure function, if the radius measured along the plane with Direction[0] as normal is above this val. the strength will be zero
#var AnyVar UserDefinedRadiusLimit;
#if (DisplayTriggerVolume)
BaseObject = {
AnyRefNode CylRotNode = {
sRel = {0,0,0};
ARel = RotMat(..RotCoefY*..GlobalRotCoef*pi/2,y)*RotMat(..RotCoefX*..GlobalRotCoef*pi/2,x);
AnyRefNode CylNode = {
sRel = {0,0,...UserDefinedLimitLow};
AnySurfCylinder TriggerCyl =
{
Radius = ....UserDefinedRadiusLimit;
Length = - ....UserDefinedLimitLow + ....UserDefinedLimitHigh;
CapRatio = 0.001;
AnyDrawParamSurf Draw =
{
Opacity = 0.5;
};
};
};
};
};
#endif
#if (DisplayTargetNode)
TargetObject = {
AnyDrawNode DrawContactTarget = {
ScaleXYZ = {1,1,1}*0.015;
};
};
#endif
#var AnyVar Strength =3000; //strength of muscles
#var AnyVar StaticFrictionCoefficient; //Friction coefficient
#var AnyVar ScaleFactor =1; //scale factor for draw vectors it can be set differently than by the drawsettings
#var AnyInt NormalDirection;
#var AnyInt FrictionDirection1;
#var AnyInt FrictionDirection2;
AnyInt X = 0;
AnyInt Y = 1;
AnyInt Z = 2;
AnyVar GlobalRotCoef = iffun(2-NormalDirection,1,0); // 0 if z is normal, if not 1
AnyVar RotCoefY = iffun(NormalDirection,0,1);
AnyVar RotCoefX = iffun(NormalDirection,-1,0);
AnyIntArray Direction = {NormalDirection,FrictionDirection1,FrictionDirection2}; //first element gives normal direction
#include "ContactSurfaceLinPush.any"
};