/// <summary> /// Construct given elementary constraint, row in the elementary constraint and (optional) /// a native instance to copy default values from. /// </summary> /// <param name="elementaryConstraint">Elementary constraint this row data belongs to.</param> /// <param name="row">Row index in the elementary constraint.</param> /// <param name="tmpEc">Temporary native instance to copy default values from.</param> public ElementaryConstraintRowData(ElementaryConstraint elementaryConstraint, int row, agx.ElementaryConstraint tmpEc = null) { m_elementaryConstraint = elementaryConstraint; m_row = row; if (tmpEc != null) { m_compliance = Convert.ToSingle(tmpEc.getCompliance(RowUInt)); m_damping = Convert.ToSingle(tmpEc.getDamping(RowUInt)); m_forceRange = new RangeReal(tmpEc.getForceRange(RowUInt)); } }
public void RestoreLocalDataFrom(agxWire.WireWinchController native) { if (native == null) { return; } Speed = Convert.ToSingle(native.getSpeed()); PulledInLength = Convert.ToSingle(native.getPulledInWireLength()); ForceRange = new RangeReal(native.getForceRange()); BrakeForceRange = new RangeReal(native.getBrakeForceRange()); }
/// <summary> /// Construct given elementary constraint, row in the elementary constraint and (optional) /// a native instance to copy default values from. /// </summary> /// <param name="elementaryConstraint">Elementary constraint this row data belongs to.</param> /// <param name="row">Row index in the elementary constraint.</param> /// <param name="tmpEc">Temporary native instance to copy default values from.</param> public ElementaryConstraintRowData(ElementaryConstraint elementaryConstraint, int row, agx.ElementaryConstraint tmpEc = null) { m_elementaryConstraint = elementaryConstraint; m_row = row; if (tmpEc != null) { m_compliance = Convert.ToSingle(tmpEc.getCompliance(RowUInt)); // AGX Dynamics damping is optimized for 60 Hz simulations. Assuming // a fixed update of 50 Hz in Unity we scale the damping by 60 / 50 = 1.2 // to transform the damping to 50 Hz. m_damping = 1.2f * Convert.ToSingle(tmpEc.getDamping(RowUInt)); m_forceRange = new RangeReal(tmpEc.getForceRange(RowUInt)); } }
/// <summary> /// Set force range to one or all rotational ordinary degrees of freedom /// (not including controllers) of this constraint. /// </summary> /// <param name="forceRange">New force range.</param> /// <param name="dof">Specific rotational degree of freedom or all.</param> public void SetForceRange(RangeReal forceRange, RotationalDof dof) { TraverseRowData(data => data.ForceRange = forceRange, dof); }
/// <summary> /// Set force range to all ordinary degrees of freedom (not including controllers) /// of this constraint. /// </summary> /// <param name="forceRange">New force range.</param> public void SetForceRange(RangeReal forceRange) { TraverseRowData(data => data.ForceRange = forceRange, TranslationalDof.All); TraverseRowData(data => data.ForceRange = forceRange, RotationalDof.All); }
protected override void Construct(ElementaryConstraint source) { base.Construct(source); m_range = new RangeReal((source as RangeController).m_range); }
protected override void Construct(agx.ElementaryConstraint tmpEc) { base.Construct(tmpEc); m_range = new RangeReal(agx.RangeController.safeCast(tmpEc).getRange()); }
public void CopyFrom(ElementaryConstraintRowData source) { m_compliance = source.m_compliance; m_damping = source.m_damping; m_forceRange = new RangeReal(source.m_forceRange); }