Skip to content

Commit

Permalink
Merge pull request #150 from Algoryx/fix/tooltips
Browse files Browse the repository at this point in the history
Added tooltips to properties of all AGXUnity asset classes
  • Loading branch information
FilipAlg committed Feb 29, 2024
2 parents b58b9b2 + 4281294 commit e4190e2
Show file tree
Hide file tree
Showing 19 changed files with 247 additions and 21 deletions.
1 change: 1 addition & 0 deletions AGXUnity/Attributes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public class InspectorSeparatorAttribute : Attribute
public class InspectorGroupBeginAttribute : Attribute
{
public string Name;
public bool DefaultExpanded = false;
}

[AttributeUsage( AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false )]
Expand Down
4 changes: 4 additions & 0 deletions AGXUnity/CableDamageProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ public enum MaxDamageColorMode {
public MaxDamageColorMode DamageColorMode = MaxDamageColorMode.HighestPerFrame;

[ClampAboveZeroInInspector]
[Tooltip("The calculated cable damage for which to use the specified max color")]
public float SetDamageForMaxColor = 0f;

[Tooltip("The color applied when there is no calculated cable damage")]
public Color MinColor = Color.green;

[Tooltip("The color applied when the calculated cable damage exceeds the \"Set Damage For Max Color\" value")]
public Color MaxColor = Color.red;


Expand Down
5 changes: 5 additions & 0 deletions AGXUnity/CableProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public CableProperties.Direction Direction
[SerializeField]
private float m_youngsModulus = 1.0E9f;
[ClampAboveZeroInInspector]
[Tooltip("Young's Modulus of the constraint")]
public float YoungsModulus
{
get { return m_youngsModulus; }
Expand All @@ -42,6 +43,7 @@ public float YoungsModulus
private float m_poissonsRatio = 0.333f;

[HideInInspector]
[Tooltip( "Ratio of Stress over Strain. Will affect rotational stiffness when twisting." )]
public float PoissonsRatio
{
get
Expand All @@ -63,6 +65,8 @@ public float PoissonsRatio
private float m_yieldPoint = float.PositiveInfinity;

[ClampAboveZeroInInspector( true )]
[HideInInspector]
[Tooltip( "The torque required to permanently deform the cable, i.e., to cause a plastic deformation" )]
public float YieldPoint
{
get { return m_yieldPoint; }
Expand All @@ -78,6 +82,7 @@ public float YieldPoint
private float m_damping = 2.0f / 50;

[ClampAboveZeroInInspector( true )]
[Tooltip("The damping of the constraint")]
public float Damping
{
get { return m_damping; }
Expand Down
7 changes: 7 additions & 0 deletions AGXUnity/ConstraintMergeSplitThresholds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public class ConstraintMergeSplitThresholds : MergeSplitThresholds
private float m_maxRelativeSpeed = 5.0E-3f;

[ClampAboveZeroInInspector( true )]
[InspectorGroupBegin(Name = "Merge conditions", DefaultExpanded = true)]
[Tooltip( "When the relative motion between the objects is less than this threshold, the objects may merge." )]
public float MaxRelativeSpeed
{
get { return m_maxRelativeSpeed; }
Expand All @@ -31,6 +33,8 @@ public float MaxRelativeSpeed
private float m_maxDesiredSpeedDiff = 1.0E-5f;

[ClampAboveZeroInInspector( true )]
[InspectorGroupBegin(Name = "Split conditions", DefaultExpanded = true)]
[Tooltip( "When the relative motion between the objects is less than this threshold, the objects may merge." )]
public float MaxDesiredSpeedDiff
{
get { return m_maxDesiredSpeedDiff; }
Expand All @@ -46,6 +50,7 @@ public float MaxDesiredSpeedDiff
private float m_maxDesiredLockAngleDiff = 1.0E-5f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "The maximum difference the 'force range'/desired force range parameter in any controller may change without splitting the constrained objects. " )]
public float MaxDesiredLockAngleDiff
{
get { return m_maxDesiredLockAngleDiff; }
Expand All @@ -61,6 +66,7 @@ public float MaxDesiredLockAngleDiff
private float m_maxDesiredRangeAngleDiff = 1.0E-5f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "The maximum difference the 'position'/desired angle parameter in a lock controller may change without splitting the constrained objects. " )]
public float MaxDesiredRangeAngleDiff
{
get { return m_maxDesiredRangeAngleDiff; }
Expand All @@ -76,6 +82,7 @@ public float MaxDesiredRangeAngleDiff
private float m_maxDesiredForceRangeDiff = 1.0E-1f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "The maximum difference the 'force range'/desired force range parameter in any controller may change without splitting the constrained objects. " )]
public float MaxDesiredForceRangeDiff
{
get { return m_maxDesiredForceRangeDiff; }
Expand Down
15 changes: 15 additions & 0 deletions AGXUnity/ContactMaterial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public enum ContactReductionLevelType
/// this contact material has been initialized.
/// </summary>
[AllowRecursiveEditing]
[Tooltip("One of the materials for which this ContactMaterial defines contacts")]
public ShapeMaterial Material1
{
get { return m_material1; }
Expand All @@ -85,6 +86,7 @@ public ShapeMaterial Material1
/// this contact material has been initialized.
/// </summary>
[AllowRecursiveEditing]
[Tooltip( "One of the materials for which this ContactMaterial defines contacts" )]
public ShapeMaterial Material2
{
get { return m_material2; }
Expand All @@ -104,6 +106,7 @@ public ShapeMaterial Material2
/// Get or set friction model coupled to this contact material.
/// </summary>
[AllowRecursiveEditing]
[Tooltip( "The friction model coupled to this contact material." )]
public FrictionModel FrictionModel
{
get { return m_frictionModel; }
Expand All @@ -125,6 +128,7 @@ public FrictionModel FrictionModel
/// Get or set Young's modulus of this contact material.
/// </summary>
[ClampAboveZeroInInspector]
[Tooltip( "This specifies the stiffness of the contact between the interacting geometries/bodies" )]
public float YoungsModulus
{
get { return m_youngsModulus; }
Expand All @@ -146,6 +150,7 @@ public float YoungsModulus
/// Get or set surface viscosity of this contact material.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "The viscosity of a surface material is the same thing as compliance but for friction in contacts" )]
public Vector2 SurfaceViscosity
{
get { return m_surfaceViscosity; }
Expand All @@ -169,6 +174,7 @@ public Vector2 SurfaceViscosity
/// Get or set friction coefficients of this contact material.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "The coefficients of friction in the friction frame (default: world frame)" )]
public Vector2 FrictionCoefficients
{
get { return m_frictionCoefficients; }
Expand All @@ -192,6 +198,7 @@ public Vector2 FrictionCoefficients
/// Get or set restitution of this contact material.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "This defines the \"bounciness\" of a contact." )]
public float Restitution
{
get { return m_restitution; }
Expand All @@ -212,6 +219,8 @@ public float Restitution
/// <summary>
/// Damping of the contact constraint. Default: 4.5 / 60 = 0.075.
/// </summary>
[ClampAboveZeroInInspector(true)]
[Tooltip( "This defines the time it should take for the solver to restore an overlap. A higher value will lead to higher restoration forces as overlaps should be minimized faster" )]
public float Damping
{
get { return m_damping; }
Expand All @@ -233,6 +242,7 @@ public float Damping
/// Adhesive force of the contacts with this contact material.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "Determines a force used for keeping colliding objects together" )]
public float AdhesiveForce
{
get { return m_adhesiveForce; }
Expand All @@ -256,6 +266,7 @@ public float AdhesiveForce
/// at higher overlap, the (usual) contact force.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "allowed overlap from surface for resting contact. At this overlap, no force is applied. At lower overlap, the adhesion force will work, at higher overlap, the (usual) contact force" )]
public float AdhesiveOverlap
{
get { return m_adhesiveOverlap; }
Expand All @@ -276,6 +287,7 @@ public float AdhesiveOverlap
/// <summary>
/// Enable/disable contact area approach of contacts using this contact material.
/// </summary>
[Tooltip( "If set to “true”, an approximation to the contact area will be geometrically computed for each contact involving this contact material. For each contact, its area will then be evenly distributed between its contact points. The contact compliance will be scaled with the inverse of the area for each contact point." )]
public bool UseContactArea
{
get { return m_useContactArea; }
Expand All @@ -296,6 +308,7 @@ public bool UseContactArea
/// <summary>
/// Contact reduction mode, default Geometry.
/// </summary>
[Tooltip(" Specifies at which level the contact reduction algorithm should be run. None, Geometry, or Geometry and Rigidbody")]
public ContactReductionType ContactReductionMode
{
get { return m_contactReductionMode; }
Expand All @@ -316,6 +329,7 @@ public ContactReductionType ContactReductionMode
/// <summary>
/// Contact reduction level when contact reduction is enabled (ContactReductionMode != None).
/// </summary>
[Tooltip( "Contact reduction level when contact reduction is enabled (ContactReductionMode != None)" )]
public ContactReductionLevelType ContactReductionLevel
{
get { return m_contactReductionLevel; }
Expand Down Expand Up @@ -345,6 +359,7 @@ public ContactReductionLevelType ContactReductionLevel
/// along the contact edge on the object the wire interacts with.
/// </summary>
[ClampAboveZeroInInspector( true )]
[Tooltip( "Wire friction coefficients of this contact material, used by the contact nodes on a wire. The primary (x) friction coefficient is used along the wire and the secondary (y) is along the contact edge on the object the wire interacts with." )]
public Vector2 WireFrictionCoefficients
{
get { return m_wireFrictionCoefficients; }
Expand Down
54 changes: 54 additions & 0 deletions AGXUnity/GeometryContactMergeSplitThresholds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ public class GeometryContactMergeSplitThresholds : MergeSplitThresholds
[SerializeField]
private float m_maxRelativeNormalSpeed = 0.01f;

[InspectorGroupBegin(Name = "Merge conditions", DefaultExpanded = true)]
[ClampAboveZeroInInspector( true )]
[Tooltip( "Maximum speed along a contact normal for a contact to be considered resting." )]
public float MaxRelativeNormalSpeed
{
get { return m_maxRelativeNormalSpeed; }
Expand All @@ -31,6 +33,7 @@ public float MaxRelativeNormalSpeed
private float m_maxRelativeTangentSpeed = 0.01f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "Maximum (sliding) speed along a contact tangent for a contact to be considered resting." )]
public float MaxRelativeTangentSpeed
{
get { return m_maxRelativeTangentSpeed; }
Expand All @@ -46,6 +49,7 @@ public float MaxRelativeTangentSpeed
private float m_maxRollingSpeed = 0.01f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "Maximum rolling speed for a contact to be considered resting. " )]
public float MaxRollingSpeed
{
get { return m_maxRollingSpeed; }
Expand All @@ -61,6 +65,8 @@ public float MaxRollingSpeed
private float m_maxImpactSpeed = 0.01f;

[ClampAboveZeroInInspector( true )]
[InspectorGroupBegin(Name = "Split conditions", DefaultExpanded = true)]
[Tooltip( "Maximum impact speed (along a contact normal) a merged object can resist without being split. " )]
public float MaxImpactSpeed
{
get { return m_maxImpactSpeed; }
Expand All @@ -72,9 +78,42 @@ public float MaxImpactSpeed
}
}

[SerializeField]
private float m_normalAdhesion = 0.0f;

[ClampAboveZeroInInspector(true)]
[Tooltip("Adhesive force in the normal directions preventing the object to split (if > 0) when the object is subject to external interactions (e.g., constraints).")]
public float NormalAdhesion
{
get => m_normalAdhesion;
set
{
m_normalAdhesion = value;
if(Native != null)
Native.setNormalAdhesion( value );
}
}

[SerializeField]
private float m_tangentialAdhesion = 0.0f;

[ClampAboveZeroInInspector( true )]
[Tooltip( "Adhesive force in the tangential directions preventing the object to split (if > 0) when the object is subject to external interactions (e.g., constraints)." )]
public float TangentialAdhesion
{
get => m_tangentialAdhesion;
set
{
m_tangentialAdhesion = value;
if ( Native != null )
Native.setTangentialAdhesion( value );
}
}

[SerializeField]
private bool m_splitOnLogicalImpact = false;

[Tooltip("If true, merged bodies will split when objects first collide, else the \"Max Impact speed\" will be used.")]
public bool SplitOnLogicalImpact
{
get { return m_splitOnLogicalImpact; }
Expand All @@ -86,6 +125,21 @@ public bool SplitOnLogicalImpact
}
}

[SerializeField]
private bool m_maySplitInGravityField = false;

[Tooltip( "If true, check split given external forces for all objects merged (i.e., rb->getForce() the sum of rb->addForce(), including the gravity force). " )]
public bool MaySplitInGravityField
{
get => m_maySplitInGravityField;
set
{
m_maySplitInGravityField = value;
if ( Native != null )
Native.setMaySplitInGravityField( value );
}
}

public agxSDK.GeometryContactMergeSplitThresholds Native { get; private set; }

public override void ResetToDefault()
Expand Down
6 changes: 4 additions & 2 deletions AGXUnity/MergeSplitProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ protected override bool Initialize()
var constraints = GetComponentsInChildren<Constraint>();
foreach ( var constraint in constraints )
if ( constraint.GetInitialized<Constraint>() != null ) {
var refRB = constraint.AttachmentPair.ReferenceObject.GetComponent<RigidBody>();
var conRB = constraint.AttachmentPair.ConnectedObject.GetComponent<RigidBody>();
RigidBody refRB = constraint.AttachmentPair.ReferenceObject.GetComponent<RigidBody>();
RigidBody conRB = null;
if( constraint.AttachmentPair.ConnectedObject != null)
conRB = constraint.AttachmentPair.ConnectedObject.GetComponent<RigidBody>();
if ( !blacklist.Any( pair =>
( pair.Item1 == refRB && pair.Item2 == conRB ) ||
( pair.Item2 == refRB && pair.Item1 == conRB ) ) )
Expand Down
2 changes: 2 additions & 0 deletions AGXUnity/Model/ConveyorBeltProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class ConveyorBeltProperties : ScriptAsset
[SerializeField]
private Vector3 m_translationalCompliance = 1.0E-8f * Vector3.one;

[Tooltip("The translational compliance of the constraint connecting the individual tracks")]
public Vector3 TranslationalCompliance
{
get { return m_translationalCompliance; }
Expand All @@ -22,6 +23,7 @@ public Vector3 TranslationalCompliance
[SerializeField]
private Vector2 m_rotationalCompliance = 1.0E-8f * Vector2.one;

[Tooltip( "The rotational compliance of the constraint connecting the individual tracks" )]
public Vector2 RotationalCompliance
{
get { return m_rotationalCompliance; }
Expand Down
Loading

0 comments on commit e4190e2

Please sign in to comment.