117 lines (95 with data), 4.3 kB
#class_template ConditionalContact3PointsClass (AnyRefFrame &BaseObject, AnyRefFrame &TargetObject1, AnyRefFrame &TargetObject2, AnyRefFrame &TargetObject3, DisplayTriggerVolume, DisplayTargetNode)
{
//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;
#var AnyVar StaticFrictionCoefficient; //Friction coefficient
#var AnyVar Strength =1000; //strength of muscles
#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);
#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)
TargetObject1 = {
AnyDrawNode DrawContactTarget = {
ScaleXYZ = {1,1,1}*0.015;
};
};
TargetObject2 = {
AnyDrawNode DrawContactTarget = {
ScaleXYZ = {1,1,1}*0.015;
};
};
TargetObject3 = {
AnyDrawNode DrawContactTarget = {
ScaleXYZ = {1,1,1}*0.015;
};
};
#endif
ConditionalContactClass Contac1 (BaseObject = BaseObject, TargetObject = TargetObject1, DisplayTriggerVolume = 0, DisplayTargetNode = 0)=
{
StaticFrictionCoefficient = .StaticFrictionCoefficient;
Strength = .Strength;
ScaleFactor = .ScaleFactor;
UserDefinedLimitLow = .UserDefinedLimitLow;
UserDefinedLimitHigh = .UserDefinedLimitHigh;
UserDefinedRadiusLimit = .UserDefinedRadiusLimit;
NormalDirection = .NormalDirection;
FrictionDirection1 = .FrictionDirection1;
FrictionDirection2 = .FrictionDirection2;
};
ConditionalContactClass Contac2 (BaseObject = BaseObject, TargetObject = TargetObject2, DisplayTriggerVolume = 0, DisplayTargetNode = 0)=
{
StaticFrictionCoefficient = .StaticFrictionCoefficient;
Strength = .Strength;
ScaleFactor = .ScaleFactor;
UserDefinedLimitLow = .UserDefinedLimitLow;
UserDefinedLimitHigh = .UserDefinedLimitHigh;
UserDefinedRadiusLimit = .UserDefinedRadiusLimit;
NormalDirection = .NormalDirection;
FrictionDirection1 = .FrictionDirection1;
FrictionDirection2 = .FrictionDirection2;
};
ConditionalContactClass Contac3 (BaseObject = BaseObject, TargetObject = TargetObject3, DisplayTriggerVolume = 0, DisplayTargetNode = 0)=
{
StaticFrictionCoefficient = .StaticFrictionCoefficient;
Strength = .Strength;
ScaleFactor = .ScaleFactor;
UserDefinedLimitLow = .UserDefinedLimitLow;
UserDefinedLimitHigh = .UserDefinedLimitHigh;
UserDefinedRadiusLimit = .UserDefinedRadiusLimit;
NormalDirection = .NormalDirection;
FrictionDirection1 = .FrictionDirection1;
FrictionDirection2 = .FrictionDirection2;
};
};