public FrictionModel RestoreLocalDataFrom(agx.FrictionModel native) { SolveType = Convert(native.getSolveType()); Type = FindType(native); // TODO: How do we handle oriented when restoring from file? if (Type == EType.ConstantNormalForceBoxFriction) { NormalForceMagnitude = System.Convert.ToSingle(native.asConstantNormalForceOrientedBoxFrictionModel().getNormalForceMagnitude()); ScaleNormalForceWithDepth = native.asConstantNormalForceOrientedBoxFrictionModel().getEnableScaleWithDepth(); } return(this); }
/// <summary> /// Finds friction model type given native instance. /// </summary> /// <param name="native">Native friction model.</param> /// <returns>Native friction model type.</returns> public static EType FindType(agx.FrictionModel native) { if (native == null || native.asIterativeProjectedConeFriction() != null) { return(EType.IterativeProjectedFriction); } else if (native.asScaleBoxFrictionModel() != null) { return(EType.ScaleBoxFriction); } else if (native.asConstantNormalForceOrientedBoxFrictionModel() != null) { return(EType.ConstantNormalForceBoxFriction); } else if (native.asBoxFrictionModel() != null) { return(EType.BoxFriction); } Debug.LogWarning("Unknown native friction model type - returning default."); return(EType.IterativeProjectedFriction); }