/// <inheritdoc/> protected internal override void Initialize() { D6Joint joint = (D6Joint)InspectedObject; BuildGUI(joint, true); drawer.AddDefault(joint, typeof(D6Joint)); drawer.BeginCategory("Motion constraints"); for (int i = 0; i < (int)D6JointAxis.Count; i++) { D6JointAxis axis = (D6JointAxis)i; string entryName = Enum.GetName(typeof(D6JointAxis), axis); drawer.AddField(entryName, () => joint.GetMotion(axis), x => joint.SetMotion(axis, x)); } drawer.BeginCategory("Drive"); drawer.AddField("Drive position", () => joint.DrivePosition, x => joint.SetDriveTransform(x, joint.DriveRotation)); drawer.AddField("Drive rotation", () => joint.DriveRotation.ToEuler(), x => joint.SetDriveTransform(joint.DrivePosition, Quaternion.FromEuler(x))); drawer.AddField("Drive linear velocity", () => joint.DriveLinearVelocity, x => joint.SetDriveVelocity(x, joint.DriveAngularVelocity)); drawer.AddField("Drive angular velocity", () => joint.DriveAngularVelocity, x => joint.SetDriveVelocity(joint.DriveLinearVelocity, x)); for (int i = 0; i < (int)D6JointDriveType.Count; i++) { D6JointDriveType type = (D6JointDriveType)i; string entryName = Enum.GetName(typeof(D6JointDriveType), type); drawer.AddField(entryName, () => joint.GetDrive(type), x => joint.SetDrive(type, x)); } drawer.EndCategory(); }
/// <summary> /// Determines a drive that will attempt to move the specified degree(s) of freedom to the wanted position and velocity. /// </summary> public D6JointDrive GetDrive(D6JointDriveType type) { D6JointDrive temp; Internal_getDrive(mCachedPtr, type, out temp); return(temp); }
public void SetDrive(D6JointDriveType index, D6JointDrive value) { #if UNIT_TEST_COMPILANT throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set."); #else Internal_SetDrive(unmanagedPtr, index, ref value); #endif }
public D6JointDrive GetDrive(D6JointDriveType index) { #if UNIT_TEST_COMPILANT throw new NotImplementedException("Unit tests, don't support methods calls. Only properties can be get or set."); #else D6JointDrive resultAsRef; Internal_GetDrive(unmanagedPtr, index, out resultAsRef); return(resultAsRef); #endif }
/// <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> /// Creates GUI elements for fields specific to the spherical joint. /// </summary> protected void BuildGUI(D6Joint joint) { for (int i = 0; i < (int)D6JointAxis.Count; i++) { D6JointAxis axis = (D6JointAxis)i; string entryName = Enum.GetName(typeof(D6JointAxis), axis); motionFields[i] = new GUIEnumField(typeof(D6JointMotion), new LocEdString(entryName)); motionFields[i].OnSelectionChanged += x => { joint.SetMotion(axis, (D6JointMotion)x); MarkAsModified(); ConfirmModify(); }; } linearLimitFoldout.AcceptsKeyFocus = false; linearLimitFoldout.OnToggled += x => { linearLimitLayout.Active = x; Persistent.SetBool("linearLimit_Expanded", x); }; twistLimitFoldout.AcceptsKeyFocus = false; twistLimitFoldout.OnToggled += x => { twistLimitLayout.Active = x; Persistent.SetBool("twistLimit_Expanded", x); }; swingLimitFoldout.AcceptsKeyFocus = false; swingLimitFoldout.OnToggled += x => { swingLimitLayout.Active = x; Persistent.SetBool("swingLimit_Expanded", x); }; driveFoldout.AcceptsKeyFocus = false; driveFoldout.OnToggled += x => { driveLayout.Active = x; Persistent.SetBool("drive_Expanded", x); }; drivePositionField.OnChanged += x => { joint.SetDriveTransform(x, joint.DriveRotation); MarkAsModified(); }; drivePositionField.OnFocusLost += ConfirmModify; drivePositionField.OnConfirmed += ConfirmModify; driveRotationField.OnChanged += x => { joint.SetDriveTransform(joint.DrivePosition, Quaternion.FromEuler(x)); MarkAsModified(); }; driveRotationField.OnFocusLost += ConfirmModify; driveRotationField.OnConfirmed += ConfirmModify; driveLinVelocityField.OnChanged += x => { joint.SetDriveVelocity(x, joint.DriveAngularVelocity); MarkAsModified(); }; driveLinVelocityField.OnFocusLost += ConfirmModify; driveLinVelocityField.OnConfirmed += ConfirmModify; driveAngVelocityField.OnChanged += x => { joint.SetDriveVelocity(joint.DriveLinearVelocity, x); MarkAsModified(); }; driveAngVelocityField.OnFocusLost += ConfirmModify; driveAngVelocityField.OnConfirmed += ConfirmModify; for (int i = 0; i < (int)D6JointAxis.Count; i++) { Layout.AddElement(motionFields[i]); } Layout.AddElement(linearLimitFoldout); linearLimitLayout = Layout.AddLayoutX(); { linearLimitLayout.AddSpace(10); GUILayoutY linearLimitContentsLayout = linearLimitLayout.AddLayoutY(); limitLinearGUI = new LimitLinearGUI(joint.LimitLinear, linearLimitContentsLayout, Persistent); limitLinearGUI.OnChanged += (x, y) => { joint.LimitLinear = x; joint.LimitLinear.SetBase(y); MarkAsModified(); }; limitLinearGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(twistLimitFoldout); twistLimitLayout = Layout.AddLayoutX(); { twistLimitLayout.AddSpace(10); GUILayoutY twistLimitContentsLayout = twistLimitLayout.AddLayoutY(); limitTwistGUI = new LimitAngularRangeGUI(joint.LimitTwist, twistLimitContentsLayout, Persistent); limitTwistGUI.OnChanged += (x, y) => { joint.LimitTwist = x; joint.LimitTwist.SetBase(y); MarkAsModified(); }; limitTwistGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(swingLimitFoldout); swingLimitLayout = Layout.AddLayoutX(); { swingLimitLayout.AddSpace(10); GUILayoutY swingLimitContentsLayout = swingLimitLayout.AddLayoutY(); limitSwingGUI = new LimitConeRangeGUI(joint.LimitSwing, swingLimitContentsLayout, Persistent); limitSwingGUI.OnChanged += (x, y) => { joint.LimitSwing = x; joint.LimitSwing.SetBase(y); MarkAsModified(); }; limitSwingGUI.OnConfirmed += ConfirmModify; } Layout.AddElement(driveFoldout); driveLayout = Layout.AddLayoutX(); { driveLayout.AddSpace(10); GUILayoutY driveContentsLayout = driveLayout.AddLayoutY(); for (int i = 0; i < (int)D6JointDriveType.Count; i++) { D6JointDriveType type = (D6JointDriveType)i; drivesGUI[i] = new D6JointDriveGUI(joint.GetDrive(type), driveContentsLayout); drivesGUI[i].OnChanged += x => { joint.SetDrive(type, x); MarkAsModified(); }; drivesGUI[i].OnConfirmed += ConfirmModify; } driveContentsLayout.AddElement(drivePositionField); driveContentsLayout.AddElement(driveRotationField); driveContentsLayout.AddElement(driveLinVelocityField); driveContentsLayout.AddElement(driveAngVelocityField); } linearLimitLayout.Active = Persistent.GetBool("linearLimit_Expanded"); twistLimitLayout.Active = Persistent.GetBool("twistLimit_Expanded"); swingLimitLayout.Active = Persistent.GetBool("swingLimit_Expanded"); driveLayout.Active = Persistent.GetBool("drive_Expanded"); base.BuildGUI(joint, true); }
public void SetDrive(D6JointDriveType type, D6JointDrive drive) { Internal_SetDrive(mCachedPtr, type, drive); }
private static extern void Internal_SetDrive(IntPtr thisPtr, D6JointDriveType type, D6JointDrive drive);
internal static extern void Internal_SetDrive(IntPtr obj, D6JointDriveType index, ref D6JointDrive value);
/// <summary> /// Sets the drive parameters for the specified drive type. /// </summary> /// <param name="index">The type of drive being specified.</param> /// <param name="value">The value.</param> public void SetDrive(D6JointDriveType index, D6JointDrive value) { Internal_SetDrive(unmanagedPtr, index, ref value); }
internal static extern void Internal_GetDrive(IntPtr obj, D6JointDriveType index, out D6JointDrive resultAsRef);
/// <summary> /// Gets the drive parameters for the specified drive type. /// </summary> /// <param name="index">The type of drive being specified.</param> /// <returns>The value.</returns> public D6JointDrive GetDrive(D6JointDriveType index) { Internal_GetDrive(unmanagedPtr, index, out var resultAsRef); return(resultAsRef); }
/// <summary> /// Returns properties for the specified drive type. /// </summary> /// <param name="type">Type of drive to retrieve properties for.</param> /// <returns>Properties for the requested drive type.</returns> public D6JointDrive GetDrive(D6JointDriveType type) { return([email protected][(int)type]); }
private static extern void Internal_getDrive(IntPtr thisPtr, D6JointDriveType type, out D6JointDrive __output);