/// <summary>Initializes the struct with default values.</summary> public static D6JointDrive Default() { D6JointDrive value = new D6JointDrive(); value.stiffness = 0f; value.damping = 0f; value.forceLimit = 3.40282347E+38f; value.acceleration = false; return(value); }
/// <summary> /// Sets a drive that will attempt to move the specified degree(s) of freedom to the wanted position and velocity. /// </summary> /// <param name="type">Type of the drive.</param> /// <param name="drive">Drive properties.</param> public void SetDrive(D6JointDriveType type, D6JointDrive drive) { if ([email protected][(int)type] == drive) { return; } [email protected][(int)type] = drive; if (Native != null) { Native.SetDrive(type, drive); } }
/// <summary> /// Constructs a new set of GUI elements for inspecting the drive object. /// </summary> /// <param name="drive">Initial values to assign to the GUI elements.</param> /// <param name="layout">Layout to append the GUI elements to.</param> public D6JointDriveGUI(D6JointDrive drive, GUILayout layout) { driveData = drive; stiffnessField.OnChanged += x => { driveData.stiffness = x; MarkAsModified(); }; stiffnessField.OnFocusLost += ConfirmModify; stiffnessField.OnConfirmed += ConfirmModify; dampingField.OnChanged += x => { driveData.damping = x; MarkAsModified(); }; dampingField.OnFocusLost += ConfirmModify; dampingField.OnConfirmed += ConfirmModify; forceLimitField.OnChanged += x => { driveData.forceLimit = x; MarkAsModified(); }; forceLimitField.OnFocusLost += ConfirmModify; forceLimitField.OnConfirmed += ConfirmModify; accelerationField.OnChanged += x => { driveData.acceleration = x; MarkAsModified(); ConfirmModify(); }; layout.AddElement(stiffnessField); layout.AddElement(dampingField); layout.AddElement(forceLimitField); layout.AddElement(accelerationField); }
private static extern void Internal_setDrive(IntPtr thisPtr, D6JointDriveType type, ref D6JointDrive drive);
private static extern void Internal_getDrive(IntPtr thisPtr, D6JointDriveType type, out D6JointDrive __output);
/// <summary> /// Determines a drive that will attempt to move the specified degree(s) of freedom to the wanted position and velocity. /// </summary> public void SetDrive(D6JointDriveType type, D6JointDrive drive) { Internal_setDrive(mCachedPtr, type, ref drive); }