Forráskód Böngészése

Refactored arc drawing so both start and amount angle increase in the same direction
Fixed hinge and spherical joint gizmos

BearishSun 9 éve
szülő
commit
d4a73eb5c6

+ 5 - 5
Source/BansheeEditor/Source/BsGizmoManager.cpp

@@ -245,11 +245,11 @@ namespace BansheeEngine
 		Vector3 topHemisphere = position + Vector3(0.0f, halfHeight, 0.0f);
 		Vector3 topHemisphere = position + Vector3(0.0f, halfHeight, 0.0f);
 		Vector3 botHemisphere = position + Vector3(0.0f, -halfHeight, 0.0f);
 		Vector3 botHemisphere = position + Vector3(0.0f, -halfHeight, 0.0f);
 
 
-		drawWireArc(topHemisphere, Vector3::UNIT_X, radius, Degree(270.0f), Degree(180.0f));
-		drawWireArc(topHemisphere, Vector3::UNIT_Z, radius, Degree(0.0f), Degree(180.0f));
+		drawWireArc(topHemisphere, Vector3::UNIT_X, radius, Degree(270.0f), -Degree(180.0f));
+		drawWireArc(topHemisphere, Vector3::UNIT_Z, radius, Degree(0.0f), -Degree(180.0f));
 
 
-		drawWireArc(botHemisphere, Vector3::UNIT_X, radius, Degree(90.0f), Degree(180.0f));
-		drawWireArc(botHemisphere, Vector3::UNIT_Z, radius, Degree(180.0f), Degree(180.0f));
+		drawWireArc(botHemisphere, Vector3::UNIT_X, radius, Degree(90.0f), -Degree(180.0f));
+		drawWireArc(botHemisphere, Vector3::UNIT_Z, radius, Degree(180.0f), -Degree(180.0f));
 
 
 		drawWireDisc(topHemisphere, Vector3::UNIT_Y, radius);
 		drawWireDisc(topHemisphere, Vector3::UNIT_Y, radius);
 		drawWireDisc(botHemisphere, Vector3::UNIT_Y, radius);
 		drawWireDisc(botHemisphere, Vector3::UNIT_Y, radius);
@@ -268,7 +268,7 @@ namespace BansheeEngine
 		sphereData.sceneObject = mActiveSO;
 		sphereData.sceneObject = mActiveSO;
 		sphereData.pickable = mPickable;
 		sphereData.pickable = mPickable;
 
 
-		mDrawHelper->cone(base, normal, height, radius, scale);
+		mDrawHelper->wireCone(base, normal, height, radius, scale);
 		mIdxToSceneObjectMap[sphereData.idx] = mActiveSO;
 		mIdxToSceneObjectMap[sphereData.idx] = mActiveSO;
 	}
 	}
 
 

+ 1 - 1
Source/BansheeEngine/Source/BsBuiltinResources.cpp

@@ -899,7 +899,7 @@ namespace BansheeEngine
 		ShapeMeshes3D::getNumElementsCone(10, coneNumVertices, coneNumIndices);
 		ShapeMeshes3D::getNumElementsCone(10, coneNumVertices, coneNumIndices);
 		MeshDataPtr coneMeshData = bs_shared_ptr_new<MeshData>(coneNumVertices, coneNumIndices, vertexDesc);
 		MeshDataPtr coneMeshData = bs_shared_ptr_new<MeshData>(coneNumVertices, coneNumIndices, vertexDesc);
 
 
-		ShapeMeshes3D::solidCone(Vector3::ZERO, Vector3::UNIT_Y, 1.0f, 1.0f, coneMeshData, 0, 0);
+		ShapeMeshes3D::solidCone(Vector3::ZERO, Vector3::UNIT_Y, 1.0f, 1.0f, Vector2::ONE, coneMeshData, 0, 0);
 		MeshPtr coneMesh = Mesh::_createPtr(coneMeshData);
 		MeshPtr coneMesh = Mesh::_createPtr(coneMeshData);
 
 
 		UINT32 quadNumVertices = 8;
 		UINT32 quadNumVertices = 8;

+ 17 - 19
Source/BansheeEngine/Source/BsShapeMeshes3D.cpp

@@ -585,12 +585,12 @@ namespace BansheeEngine
 		for (UINT32 i = 0; i < numTriangles; i++)
 		for (UINT32 i = 0; i < numTriangles; i++)
 		{
 		{
 			outIndices[i * 6 + 0] = frontSideOffset + 0;
 			outIndices[i * 6 + 0] = frontSideOffset + 0;
-			outIndices[i * 6 + 1] = frontSideOffset + i + 1;
-			outIndices[i * 6 + 2] = frontSideOffset + i;
+			outIndices[i * 6 + 1] = frontSideOffset + i;
+			outIndices[i * 6 + 2] = frontSideOffset + i + 1;
 
 
 			outIndices[i * 6 + 3] = backSideOffset + 0;
 			outIndices[i * 6 + 3] = backSideOffset + 0;
-			outIndices[i * 6 + 4] = backSideOffset + i;
-			outIndices[i * 6 + 5] = backSideOffset + i + 1;
+			outIndices[i * 6 + 4] = backSideOffset + i + 1;
+			outIndices[i * 6 + 5] = backSideOffset + i;
 		}
 		}
 	}
 	}
 
 
@@ -676,15 +676,15 @@ namespace BansheeEngine
 		for (UINT32 i = 0; i < numTriangles - 1; i++)
 		for (UINT32 i = 0; i < numTriangles - 1; i++)
 		{
 		{
 			outIndices[i * 3 + 0] = vertexOffset + baseIdx;
 			outIndices[i * 3 + 0] = vertexOffset + baseIdx;
-			outIndices[i * 3 + 1] = vertexOffset + i;
-			outIndices[i * 3 + 2] = vertexOffset + i + 1;
+			outIndices[i * 3 + 1] = vertexOffset + i + 1;
+			outIndices[i * 3 + 2] = vertexOffset + i;
 		}
 		}
 
 
 		{
 		{
 			UINT32 i = numTriangles - 1;
 			UINT32 i = numTriangles - 1;
 			outIndices[i * 3 + 0] = vertexOffset + baseIdx;
 			outIndices[i * 3 + 0] = vertexOffset + baseIdx;
-			outIndices[i * 3 + 1] = vertexOffset + i;
-			outIndices[i * 3 + 2] = vertexOffset + 0;
+			outIndices[i * 3 + 1] = vertexOffset + 0;
+			outIndices[i * 3 + 2] = vertexOffset + i;
 		}
 		}
 
 
 		//// Generate cone
 		//// Generate cone
@@ -711,10 +711,10 @@ namespace BansheeEngine
 
 
 				Vector3 toTop = topVertex - *b;
 				Vector3 toTop = topVertex - *b;
 
 
-				Vector3 normalLeft = Vector3::cross(toTop, *a - *b);
+				Vector3 normalLeft = Vector3::cross(*a - *b, toTop);
 				normalLeft.normalize();
 				normalLeft.normalize();
 
 
-				Vector3 normalRight = Vector3::cross(*c - *b, toTop);
+				Vector3 normalRight = Vector3::cross(toTop, *c - *b);
 				normalRight.normalize();
 				normalRight.normalize();
 
 
 				Vector3 triNormal = Vector3::normalize(normalLeft + normalRight);
 				Vector3 triNormal = Vector3::normalize(normalLeft + normalRight);
@@ -736,15 +736,15 @@ namespace BansheeEngine
 		for (UINT32 i = 0; i < numTriangles - 1; i++)
 		for (UINT32 i = 0; i < numTriangles - 1; i++)
 		{
 		{
 			outIndices[i * 3 + 0] = curVertTopOffset + i;
 			outIndices[i * 3 + 0] = curVertTopOffset + i;
-			outIndices[i * 3 + 1] = curVertBaseOffset + i + 1;
-			outIndices[i * 3 + 2] = curVertBaseOffset + i;
+			outIndices[i * 3 + 1] = curVertBaseOffset + i;
+			outIndices[i * 3 + 2] = curVertBaseOffset + i + 1;
 		}
 		}
 
 
 		{
 		{
 			UINT32 i = numTriangles - 1;
 			UINT32 i = numTriangles - 1;
 			outIndices[i * 3 + 0] = curVertTopOffset + i;
 			outIndices[i * 3 + 0] = curVertTopOffset + i;
-			outIndices[i * 3 + 1] = curVertBaseOffset + 0;
-			outIndices[i * 3 + 2] = curVertBaseOffset + i;
+			outIndices[i * 3 + 1] = curVertBaseOffset + i;
+			outIndices[i * 3 + 2] = curVertBaseOffset + 0;
 		}
 		}
 	}
 	}
 
 
@@ -1091,16 +1091,14 @@ namespace BansheeEngine
 		Vector3 right = alignWithUp.rotate(alignWithStart.rotate(Vector3::UNIT_X));
 		Vector3 right = alignWithUp.rotate(alignWithStart.rotate(Vector3::UNIT_X));
 		right.normalize();
 		right.normalize();
 
 
-		Vector3 scale3(scale.x, 0.0f, scale.y);
-		scale3 = alignWithUp.rotate(scale3);
-
-		Quaternion increment(up, angleAmount / (float)(numVertices - 1));
+		Quaternion increment(-up, angleAmount / (float)(numVertices - 1));
 
 
 		outVertices += vertexOffset * vertexStride;
 		outVertices += vertexOffset * vertexStride;
 		Vector3 curDirection = right * radius;
 		Vector3 curDirection = right * radius;
 		for (UINT32 i = 0; i < numVertices; i++)
 		for (UINT32 i = 0; i < numVertices; i++)
 		{
 		{
-			outVertices = writeVector3(outVertices, vertexStride, (center + curDirection) * scale3);
+			// Note: Ignoring scale
+			outVertices = writeVector3(outVertices, vertexStride, (center + curDirection));
 			curDirection = increment.rotate(curDirection);
 			curDirection = increment.rotate(curDirection);
 		}
 		}
 	}
 	}

+ 156 - 156
Source/MBansheeEditor/Inspectors/DistanceJointInspector.cs

@@ -1,157 +1,157 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Renders an inspector for the <see cref="DistanceJoint"/> component.
-    /// </summary>
-    [CustomInspector(typeof(DistanceJoint))]
-    public class DistanceJointInspector : JointInspector
-    {
-        private GUIToggleField enableMinLimitField = new GUIToggleField(new LocEdString("Enable minimum limit"));
-        private GUIFloatField minLimitField = new GUIFloatField("Minimum distance");
-        private GUIToggleField enableMaxLimitField = new GUIToggleField(new LocEdString("Enable maximum limit"));
-        private GUIFloatField maxLimitField = new GUIFloatField("Maximum maximum");
-        private GUIFloatField toleranceField = new GUIFloatField("Tolerance");
-        private GUIToggleField enableSpringField = new GUIToggleField(new LocEdString("Enable spring"));
-        private SpringGUI springGUI;
-
-        private GUILayoutX springLayout;
-
-        /// <inheritdoc/>
-        protected internal override void Initialize()
-        {
-            DistanceJoint joint = InspectedObject as DistanceJoint;
-
-            if (joint != null)
-                BuildGUI(joint);
-        }
-
-        /// <inheritdoc/>
-        protected internal override InspectableState Refresh()
-        {
-            DistanceJoint joint = InspectedObject as DistanceJoint;
-            if (joint == null)
-                return InspectableState.NotModified;
-
-            Refresh(joint);
-
-            InspectableState oldState = modifyState;
-            if (modifyState.HasFlag(InspectableState.Modified))
-                modifyState = InspectableState.NotModified;
-
-            return oldState;
-        }
-
-        /// <summary>
-        /// Creates GUI elements for fields specific to the distance joint.
-        /// </summary>
-        protected void BuildGUI(DistanceJoint joint)
-        {
-            enableMinLimitField.OnChanged += x =>
-            {
-                joint.EnableMinDistanceLimit = x;
-                MarkAsModified();
-                ConfirmModify();
-
-                minLimitField.Active = x;
-            };
-
-            minLimitField.OnChanged += x => { joint.MinDistance = x; MarkAsModified(); };
-            minLimitField.OnFocusLost += ConfirmModify;
-            minLimitField.OnConfirmed += ConfirmModify;
-
-            enableMaxLimitField.OnChanged += x =>
-            {
-                joint.EnableMaxDistanceLimit = x;
-                MarkAsModified();
-                ConfirmModify();
-
-                maxLimitField.Active = x;
-            };
-
-            maxLimitField.OnChanged += x => { joint.MaxDistance = x; MarkAsModified(); };
-            maxLimitField.OnFocusLost += ConfirmModify;
-            maxLimitField.OnConfirmed += ConfirmModify;
-
-            toleranceField.OnChanged += x => { joint.Tolerance = x; MarkAsModified(); };
-            toleranceField.OnFocusLost += ConfirmModify;
-            toleranceField.OnConfirmed += ConfirmModify;
-
-            enableSpringField.OnChanged += x =>
-            {
-                joint.EnableSpring = x;
-                MarkAsModified();
-                ConfirmModify();
-
-                springLayout.Active = x;
-            };
-
-            Layout.AddElement(enableMinLimitField);
-            GUILayoutX minLimitLayout = Layout.AddLayoutX();
-            {
-                minLimitLayout.AddSpace(10);
-                minLimitLayout.AddElement(minLimitField);
-            }
-
-            Layout.AddElement(enableMaxLimitField);
-            GUILayoutX maxLimitLayout = Layout.AddLayoutX();
-            {
-                maxLimitLayout.AddSpace(10);
-                maxLimitLayout.AddElement(maxLimitField);
-            }
-
-            Layout.AddElement(toleranceField);
-            Layout.AddElement(enableSpringField);
-            springLayout = Layout.AddLayoutX();
-            {
-                springLayout.AddSpace(10);
-                springGUI = new SpringGUI(joint.Spring, springLayout);
-                springGUI.OnChanged += x => { joint.Spring = x; MarkAsModified(); };
-                springGUI.OnConfirmed += ConfirmModify;
-            }
-
-            minLimitField.Active = joint.EnableMinDistanceLimit;
-            maxLimitField.Active = joint.EnableMaxDistanceLimit;
-            springLayout.Active = joint.EnableSpring;
-
-            base.BuildGUI(joint);
-        }
-
-        /// <summary>
-        /// Updates all GUI elements from current values in the joint.
-        /// </summary>
-        /// <param name="joint">Joint to update the GUI from.</param>
-        protected void Refresh(DistanceJoint joint)
-        {
-            if (enableMinLimitField.Value != joint.EnableMinDistanceLimit)
-            {
-                enableMinLimitField.Value = joint.EnableMinDistanceLimit;
-                minLimitField.Active = joint.EnableMinDistanceLimit;
-            }
-
-            minLimitField.Value = joint.MinDistance;
-
-            if (enableMaxLimitField.Value != joint.EnableMaxDistanceLimit)
-            {
-                enableMaxLimitField.Value = joint.EnableMaxDistanceLimit;
-                maxLimitField.Active = joint.EnableMaxDistanceLimit;
-            }
-
-            maxLimitField.Value = joint.MaxDistance;
-            toleranceField.Value = joint.Tolerance;
-
-            if (enableSpringField.Value != joint.EnableSpring)
-            {
-                enableSpringField.Value = joint.EnableSpring;
-                springLayout.Active = joint.EnableSpring;
-            }
-
-            springGUI.Spring = joint.Spring;
-
-            base.Refresh(joint);
-        }
-    }
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Renders an inspector for the <see cref="DistanceJoint"/> component.
+    /// </summary>
+    [CustomInspector(typeof(DistanceJoint))]
+    public class DistanceJointInspector : JointInspector
+    {
+        private GUIToggleField enableMinLimitField = new GUIToggleField(new LocEdString("Enable minimum limit"));
+        private GUIFloatField minLimitField = new GUIFloatField(new LocEdString("Minimum distance"));
+        private GUIToggleField enableMaxLimitField = new GUIToggleField(new LocEdString("Enable maximum limit"));
+        private GUIFloatField maxLimitField = new GUIFloatField(new LocEdString("Maximum maximum"));
+        private GUIFloatField toleranceField = new GUIFloatField(new LocEdString("Tolerance"));
+        private GUIToggleField enableSpringField = new GUIToggleField(new LocEdString("Enable spring"));
+        private SpringGUI springGUI;
+
+        private GUILayoutX springLayout;
+
+        /// <inheritdoc/>
+        protected internal override void Initialize()
+        {
+            DistanceJoint joint = InspectedObject as DistanceJoint;
+
+            if (joint != null)
+                BuildGUI(joint);
+        }
+
+        /// <inheritdoc/>
+        protected internal override InspectableState Refresh()
+        {
+            DistanceJoint joint = InspectedObject as DistanceJoint;
+            if (joint == null)
+                return InspectableState.NotModified;
+
+            Refresh(joint);
+
+            InspectableState oldState = modifyState;
+            if (modifyState.HasFlag(InspectableState.Modified))
+                modifyState = InspectableState.NotModified;
+
+            return oldState;
+        }
+
+        /// <summary>
+        /// Creates GUI elements for fields specific to the distance joint.
+        /// </summary>
+        protected void BuildGUI(DistanceJoint joint)
+        {
+            enableMinLimitField.OnChanged += x =>
+            {
+                joint.EnableMinDistanceLimit = x;
+                MarkAsModified();
+                ConfirmModify();
+
+                minLimitField.Active = x;
+            };
+
+            minLimitField.OnChanged += x => { joint.MinDistance = x; MarkAsModified(); };
+            minLimitField.OnFocusLost += ConfirmModify;
+            minLimitField.OnConfirmed += ConfirmModify;
+
+            enableMaxLimitField.OnChanged += x =>
+            {
+                joint.EnableMaxDistanceLimit = x;
+                MarkAsModified();
+                ConfirmModify();
+
+                maxLimitField.Active = x;
+            };
+
+            maxLimitField.OnChanged += x => { joint.MaxDistance = x; MarkAsModified(); };
+            maxLimitField.OnFocusLost += ConfirmModify;
+            maxLimitField.OnConfirmed += ConfirmModify;
+
+            toleranceField.OnChanged += x => { joint.Tolerance = x; MarkAsModified(); };
+            toleranceField.OnFocusLost += ConfirmModify;
+            toleranceField.OnConfirmed += ConfirmModify;
+
+            enableSpringField.OnChanged += x =>
+            {
+                joint.EnableSpring = x;
+                MarkAsModified();
+                ConfirmModify();
+
+                springLayout.Active = x;
+            };
+
+            Layout.AddElement(enableMinLimitField);
+            GUILayoutX minLimitLayout = Layout.AddLayoutX();
+            {
+                minLimitLayout.AddSpace(10);
+                minLimitLayout.AddElement(minLimitField);
+            }
+
+            Layout.AddElement(enableMaxLimitField);
+            GUILayoutX maxLimitLayout = Layout.AddLayoutX();
+            {
+                maxLimitLayout.AddSpace(10);
+                maxLimitLayout.AddElement(maxLimitField);
+            }
+
+            Layout.AddElement(toleranceField);
+            Layout.AddElement(enableSpringField);
+            springLayout = Layout.AddLayoutX();
+            {
+                springLayout.AddSpace(10);
+                springGUI = new SpringGUI(joint.Spring, springLayout);
+                springGUI.OnChanged += x => { joint.Spring = x; MarkAsModified(); };
+                springGUI.OnConfirmed += ConfirmModify;
+            }
+
+            minLimitField.Active = joint.EnableMinDistanceLimit;
+            maxLimitField.Active = joint.EnableMaxDistanceLimit;
+            springLayout.Active = joint.EnableSpring;
+
+            base.BuildGUI(joint);
+        }
+
+        /// <summary>
+        /// Updates all GUI elements from current values in the joint.
+        /// </summary>
+        /// <param name="joint">Joint to update the GUI from.</param>
+        protected void Refresh(DistanceJoint joint)
+        {
+            if (enableMinLimitField.Value != joint.EnableMinDistanceLimit)
+            {
+                enableMinLimitField.Value = joint.EnableMinDistanceLimit;
+                minLimitField.Active = joint.EnableMinDistanceLimit;
+            }
+
+            minLimitField.Value = joint.MinDistance;
+
+            if (enableMaxLimitField.Value != joint.EnableMaxDistanceLimit)
+            {
+                enableMaxLimitField.Value = joint.EnableMaxDistanceLimit;
+                maxLimitField.Active = joint.EnableMaxDistanceLimit;
+            }
+
+            maxLimitField.Value = joint.MaxDistance;
+            toleranceField.Value = joint.Tolerance;
+
+            if (enableSpringField.Value != joint.EnableSpring)
+            {
+                enableSpringField.Value = joint.EnableSpring;
+                springLayout.Active = joint.EnableSpring;
+            }
+
+            springGUI.Spring = joint.Spring;
+
+            base.Refresh(joint);
+        }
+    }
 }
 }

+ 491 - 491
Source/MBansheeEditor/Inspectors/LimitInspectors.cs

@@ -1,492 +1,492 @@
-//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
-//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-using System;
-using BansheeEngine;
-
-namespace BansheeEditor
-{
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="Spring"/> object.
-    /// </summary>
-    internal class SpringGUI
-    {
-        private Spring spring;
-
-        private GUIFloatField stiffnessField = new GUIFloatField(new LocEdString("Stiffness"));
-        private GUIFloatField dampingField = new GUIFloatField(new LocEdString("Damping"));
-
-        public Action<Spring> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current value of the spring object.
-        /// </summary>
-        public Spring Spring
-        {
-            get { return spring; }
-            set
-            {
-                spring = value;
-
-                stiffnessField.Value = value.stiffness;
-                dampingField.Value = value.damping;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the spring object.
-        /// </summary>
-        /// <param name="spring">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        public SpringGUI(Spring spring, GUILayout layout)
-        {
-            this.spring = spring;
-
-            stiffnessField.OnChanged += x => { spring.stiffness = x; MarkAsModified(); };
-            stiffnessField.OnFocusLost += ConfirmModify;
-            stiffnessField.OnConfirmed += ConfirmModify;
-
-            dampingField.OnChanged += x => { spring.damping = x; MarkAsModified(); };
-            dampingField.OnFocusLost += ConfirmModify;
-            dampingField.OnConfirmed += ConfirmModify;
-
-            layout.AddElement(stiffnessField);
-            layout.AddElement(dampingField);
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(spring);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-    }
-
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="LimitCommon"/> object.
-    /// </summary>
-    internal class LimitCommonGUI
-    {
-        private LimitCommonData limitData;
-        private SerializableProperties properties;
-        private string prefix;
-
-        private GUIToggle hardFoldout = new GUIToggle(new LocEdString("Hard"), EditorStyles.Foldout);
-        private GUIFloatField contactDistanceField = new GUIFloatField(new LocEdString("Contact distance"));
-        private GUIToggle softFoldout = new GUIToggle(new LocEdString("Soft"), EditorStyles.Foldout);
-        private GUISliderField restitutionField = new GUISliderField(0, 1, new LocEdString("Restitution"));
-        private GUIToggle springFoldout = new GUIToggle(new LocEdString("Spring"), EditorStyles.Foldout);
-        private SpringGUI springGUI;
-
-        private GUILayoutX hardLimitLayout;
-        private GUILayoutX softLimitLayout;
-        private GUILayoutX springLayout;
-
-        public Action<LimitCommonData> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current limit properties.
-        /// </summary>
-        public LimitCommonData LimitData
-        {
-            get { return limitData; }
-            set
-            {
-                limitData = value;
-
-                contactDistanceField.Value = value.contactDist;
-                restitutionField.Value = value.restitution;
-                springGUI.Spring = value.spring;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the limit object.
-        /// </summary>
-        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
-        /// <param name="limitData">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
-        ///                          </param>
-        public LimitCommonGUI(string prefix, LimitCommonData limitData, GUILayout layout, SerializableProperties properties)
-        {
-            this.limitData = limitData;
-            this.properties = properties;
-            this.prefix = prefix;
-
-            hardFoldout.OnToggled += x =>
-            {
-                properties.SetBool(prefix + "_hardLimit_Expanded", x);
-                ToggleLimitFields();
-            };
-
-            contactDistanceField.OnChanged += x => { limitData.contactDist = x; MarkAsModified(); };
-            contactDistanceField.OnFocusLost += ConfirmModify;
-            contactDistanceField.OnConfirmed += ConfirmModify;
-
-            softFoldout.OnToggled += x =>
-            {
-                properties.SetBool(prefix + "_softLimit_Expanded", x);
-                ToggleLimitFields();
-            };
-
-            restitutionField.OnChanged += x => { limitData.restitution = x; MarkAsModified(); };
-            restitutionField.OnFocusLost += ConfirmModify;
-
-            springFoldout.OnToggled += x =>
-            {
-                properties.SetBool(prefix + "_spring_Expanded", x);
-                ToggleLimitFields();
-            };
-
-            hardLimitLayout = layout.AddLayoutX();
-            {
-                hardLimitLayout.AddSpace(10);
-
-                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
-                hardLimitContentsLayout.AddElement(contactDistanceField);
-            }
-
-            softLimitLayout = layout.AddLayoutX();
-            layout.AddElement(softFoldout);
-            {
-                softLimitLayout.AddSpace(10);
-
-                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
-                softLimitContentsLayout.AddElement(restitutionField);
-                softLimitContentsLayout.AddElement(springFoldout);
-                springLayout = softLimitContentsLayout.AddLayoutX();
-                {
-                    springLayout.AddSpace(10);
-
-                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
-                    springGUI = new SpringGUI(limitData.spring, springContentsLayout);
-                    springGUI.OnChanged += x => { limitData.spring = x; MarkAsModified(); };
-                    springGUI.OnConfirmed += ConfirmModify;
-                }
-            }
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(limitData);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-
-        /// <summary>
-        /// Hides or shows limit property GUI elements depending on set properties.
-        /// </summary>
-        private void ToggleLimitFields()
-        {
-            hardLimitLayout.Active = properties.GetBool(prefix + "_hardLimit_Expanded");
-            softLimitLayout.Active = properties.GetBool(prefix + "_softLimit_Expanded");
-            springLayout.Active = properties.GetBool(prefix + "_spring_Expanded");
-        }
-    }
-
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="LimitLinear"/> object.
-    /// </summary>
-    internal class LimitLinearGUI
-    {
-        private LimitLinearData limitData;
-
-        private GUIFloatField limitExtentField = new GUIFloatField(new LocEdString("Extent"));
-        private LimitCommonGUI limitCommonGUI;
-
-        public Action<LimitLinearData, LimitCommonData> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current limit properties.
-        /// </summary>
-        public LimitLinear Limit
-        {
-            set
-            {
-                limitData = value.Data;
-
-                limitExtentField.Value = limitData.extent;
-                limitCommonGUI.LimitData = value.CommonData;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the limit object.
-        /// </summary>
-        /// <param name="limit">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
-        ///                          </param>
-        public LimitLinearGUI(LimitLinear limit, GUILayout layout, SerializableProperties properties)
-        {
-            this.limitData = limit.Data;
-
-            limitExtentField.OnChanged += x => { limitData.extent = x; MarkAsModified(); };
-            limitExtentField.OnFocusLost += ConfirmModify;
-
-            layout.AddElement(limitExtentField);
-            limitCommonGUI = new LimitCommonGUI("linear", limit.CommonData, layout, properties);
-            limitCommonGUI.OnChanged += x => MarkAsModified();
-            limitCommonGUI.OnConfirmed += ConfirmModify;
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(limitData, limitCommonGUI.LimitData);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-    }
-
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="LimitLinearRange"/> object.
-    /// </summary>
-    internal class LimitLinearRangeGUI
-    {
-        private LimitLinearRangeData limitData;
-
-        private GUIFloatField limitLowerField = new GUIFloatField(new LocEdString("Lower"));
-        private GUIFloatField limitUpperField = new GUIFloatField(new LocEdString("Upper"));
-        private LimitCommonGUI limitCommonGUI;
-
-        public Action<LimitLinearRangeData, LimitCommonData> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current limit properties.
-        /// </summary>
-        public LimitLinearRange Limit
-        {
-            set
-            {
-                limitData = value.Data;
-
-                limitLowerField.Value = limitData.lower;
-                limitUpperField.Value = limitData.upper;
-                limitCommonGUI.LimitData = value.CommonData;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the limit object.
-        /// </summary>
-        /// <param name="limit">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
-        ///                          </param>
-        public LimitLinearRangeGUI(LimitLinearRange limit, GUILayout layout, SerializableProperties properties)
-        {
-            this.limitData = limit.Data;
-
-            limitLowerField.OnChanged += x => { limitData.lower = x; MarkAsModified(); };
-            limitLowerField.OnFocusLost += ConfirmModify;
-
-            limitUpperField.OnChanged += x => { limitData.upper = x; MarkAsModified(); };
-            limitUpperField.OnFocusLost += ConfirmModify;
-
-            layout.AddElement(limitLowerField);
-            layout.AddElement(limitUpperField);
-            limitCommonGUI = new LimitCommonGUI("linearRange", limit.CommonData, layout, properties);
-            limitCommonGUI.OnChanged += x => MarkAsModified();
-            limitCommonGUI.OnConfirmed += ConfirmModify;
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(limitData, limitCommonGUI.LimitData);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-    }
-
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="LimitAngularRange"/> object.
-    /// </summary>
-    internal class LimitAngularRangeGUI
-    {
-        private LimitAngularRangeData limitData;
-
-        private GUISliderField limitLowerField = new GUISliderField(0, 360, new LocEdString("Lower"));
-        private GUISliderField limitUpperField = new GUISliderField(0, 360, new LocEdString("Upper"));
-        private LimitCommonGUI limitCommonGUI;
-
-        public Action<LimitAngularRangeData, LimitCommonData> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current limit properties.
-        /// </summary>
-        public LimitAngularRange Limit
-        {
-            set
-            {
-                limitData = value.Data;
-
-                limitLowerField.Value = limitData.lower.Degrees;
-                limitUpperField.Value = limitData.upper.Degrees;
-                limitCommonGUI.LimitData = value.CommonData;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the limit object.
-        /// </summary>
-        /// <param name="limit">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
-        ///                          </param>
-        public LimitAngularRangeGUI(LimitAngularRange limit, GUILayout layout, SerializableProperties properties)
-        {
-            this.limitData = limit.Data;
-
-            limitLowerField.OnChanged += x => { limitData.lower = new Degree(x); MarkAsModified(); };
-            limitLowerField.OnFocusLost += ConfirmModify;
-
-            limitUpperField.OnChanged += x => { limitData.upper = new Degree(x); MarkAsModified(); };
-            limitUpperField.OnFocusLost += ConfirmModify;
-
-            layout.AddElement(limitLowerField);
-            layout.AddElement(limitUpperField);
-            limitCommonGUI = new LimitCommonGUI("angularRange", limit.CommonData, layout, properties);
-            limitCommonGUI.OnChanged += x => MarkAsModified();
-            limitCommonGUI.OnConfirmed += ConfirmModify;
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(limitData, limitCommonGUI.LimitData);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-    }
-
-    /// <summary>
-    /// Draws GUI elements for inspecting an <see cref="LimitConeRange"/> object.
-    /// </summary>
-    internal class LimitConeRangeGUI
-    {
-        private LimitConeRangeData limitData;
-
-        private GUISliderField yLimitAngleField = new GUISliderField(0, 360, new LocEdString("Y limit"));
-        private GUISliderField zLimitAngleField = new GUISliderField(0, 360, new LocEdString("Z limit"));
-        private LimitCommonGUI limitCommonGUI;
-
-        public Action<LimitConeRangeData, LimitCommonData> OnChanged;
-        public Action OnConfirmed;
-
-        /// <summary>
-        /// Current limit properties.
-        /// </summary>
-        public LimitConeRange Limit
-        {
-            set
-            {
-                limitData = value.Data;
-
-                yLimitAngleField.Value = limitData.yLimitAngle.Degrees;
-                zLimitAngleField.Value = limitData.zLimitAngle.Degrees;
-                limitCommonGUI.LimitData = value.CommonData;
-            }
-        }
-
-        /// <summary>
-        /// Constructs a new set of GUI elements for inspecting the limit object.
-        /// </summary>
-        /// <param name="limit">Initial values to assign to the GUI elements.</param>
-        /// <param name="layout">Layout to append the GUI elements to.</param>
-        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
-        ///                          </param>
-        public LimitConeRangeGUI(LimitConeRange limit, GUILayout layout, SerializableProperties properties)
-        {
-            this.limitData = limit.Data;
-
-            yLimitAngleField.OnChanged += x => { limitData.yLimitAngle = new Degree(x); MarkAsModified(); };
-            yLimitAngleField.OnFocusLost += ConfirmModify;
-
-            zLimitAngleField.OnChanged += x => { limitData.zLimitAngle = new Degree(x); MarkAsModified(); };
-            zLimitAngleField.OnFocusLost += ConfirmModify;
-
-            layout.AddElement(yLimitAngleField);
-            layout.AddElement(zLimitAngleField);
-            limitCommonGUI = new LimitCommonGUI("coneRange", limit.CommonData, layout, properties);
-            limitCommonGUI.OnChanged += x => MarkAsModified();
-            limitCommonGUI.OnConfirmed += ConfirmModify;
-        }
-
-        /// <summary>
-        /// Marks the contents of the inspector as modified.
-        /// </summary>
-        private void MarkAsModified()
-        {
-            if (OnChanged != null)
-                OnChanged(limitData, limitCommonGUI.LimitData);
-        }
-
-        /// <summary>
-        /// Confirms any queued modifications.
-        /// </summary>
-        private void ConfirmModify()
-        {
-            if (OnConfirmed != null)
-                OnConfirmed();
-        }
-    }
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+using System;
+using BansheeEngine;
+
+namespace BansheeEditor
+{
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="Spring"/> object.
+    /// </summary>
+    internal class SpringGUI
+    {
+        private Spring spring;
+
+        private GUIFloatField stiffnessField = new GUIFloatField(new LocEdString("Stiffness"));
+        private GUIFloatField dampingField = new GUIFloatField(new LocEdString("Damping"));
+
+        public Action<Spring> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current value of the spring object.
+        /// </summary>
+        public Spring Spring
+        {
+            get { return spring; }
+            set
+            {
+                spring = value;
+
+                stiffnessField.Value = value.stiffness;
+                dampingField.Value = value.damping;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the spring object.
+        /// </summary>
+        /// <param name="spring">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        public SpringGUI(Spring spring, GUILayout layout)
+        {
+            this.spring = spring;
+
+            stiffnessField.OnChanged += x => { spring.stiffness = x; MarkAsModified(); };
+            stiffnessField.OnFocusLost += ConfirmModify;
+            stiffnessField.OnConfirmed += ConfirmModify;
+
+            dampingField.OnChanged += x => { spring.damping = x; MarkAsModified(); };
+            dampingField.OnFocusLost += ConfirmModify;
+            dampingField.OnConfirmed += ConfirmModify;
+
+            layout.AddElement(stiffnessField);
+            layout.AddElement(dampingField);
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(spring);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+    }
+
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="LimitCommon"/> object.
+    /// </summary>
+    internal class LimitCommonGUI
+    {
+        private LimitCommonData limitData;
+        private SerializableProperties properties;
+        private string prefix;
+
+        private GUIToggle hardFoldout = new GUIToggle(new LocEdString("Hard"), EditorStyles.Foldout);
+        private GUIFloatField contactDistanceField = new GUIFloatField(new LocEdString("Contact distance"));
+        private GUIToggle softFoldout = new GUIToggle(new LocEdString("Soft"), EditorStyles.Foldout);
+        private GUISliderField restitutionField = new GUISliderField(0, 1, new LocEdString("Restitution"));
+        private GUIToggle springFoldout = new GUIToggle(new LocEdString("Spring"), EditorStyles.Foldout);
+        private SpringGUI springGUI;
+
+        private GUILayoutX hardLimitLayout;
+        private GUILayoutX softLimitLayout;
+        private GUILayoutX springLayout;
+
+        public Action<LimitCommonData> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current limit properties.
+        /// </summary>
+        public LimitCommonData LimitData
+        {
+            get { return limitData; }
+            set
+            {
+                limitData = value;
+
+                contactDistanceField.Value = value.contactDist;
+                restitutionField.Value = value.restitution;
+                springGUI.Spring = value.spring;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the limit object.
+        /// </summary>
+        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
+        /// <param name="limitData">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public LimitCommonGUI(string prefix, LimitCommonData limitData, GUILayout layout, SerializableProperties properties)
+        {
+            this.limitData = limitData;
+            this.properties = properties;
+            this.prefix = prefix;
+
+            hardFoldout.OnToggled += x =>
+            {
+                properties.SetBool(prefix + "_hardLimit_Expanded", x);
+                ToggleLimitFields();
+            };
+
+            contactDistanceField.OnChanged += x => { limitData.contactDist = x; MarkAsModified(); };
+            contactDistanceField.OnFocusLost += ConfirmModify;
+            contactDistanceField.OnConfirmed += ConfirmModify;
+
+            softFoldout.OnToggled += x =>
+            {
+                properties.SetBool(prefix + "_softLimit_Expanded", x);
+                ToggleLimitFields();
+            };
+
+            restitutionField.OnChanged += x => { limitData.restitution = x; MarkAsModified(); };
+            restitutionField.OnFocusLost += ConfirmModify;
+
+            springFoldout.OnToggled += x =>
+            {
+                properties.SetBool(prefix + "_spring_Expanded", x);
+                ToggleLimitFields();
+            };
+
+            hardLimitLayout = layout.AddLayoutX();
+            {
+                hardLimitLayout.AddSpace(10);
+
+                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
+                hardLimitContentsLayout.AddElement(contactDistanceField);
+            }
+
+            softLimitLayout = layout.AddLayoutX();
+            layout.AddElement(softFoldout);
+            {
+                softLimitLayout.AddSpace(10);
+
+                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
+                softLimitContentsLayout.AddElement(restitutionField);
+                softLimitContentsLayout.AddElement(springFoldout);
+                springLayout = softLimitContentsLayout.AddLayoutX();
+                {
+                    springLayout.AddSpace(10);
+
+                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
+                    springGUI = new SpringGUI(limitData.spring, springContentsLayout);
+                    springGUI.OnChanged += x => { limitData.spring = x; MarkAsModified(); };
+                    springGUI.OnConfirmed += ConfirmModify;
+                }
+            }
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(limitData);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+
+        /// <summary>
+        /// Hides or shows limit property GUI elements depending on set properties.
+        /// </summary>
+        private void ToggleLimitFields()
+        {
+            hardLimitLayout.Active = properties.GetBool(prefix + "_hardLimit_Expanded");
+            softLimitLayout.Active = properties.GetBool(prefix + "_softLimit_Expanded");
+            springLayout.Active = properties.GetBool(prefix + "_spring_Expanded");
+        }
+    }
+
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="LimitLinear"/> object.
+    /// </summary>
+    internal class LimitLinearGUI
+    {
+        private LimitLinearData limitData;
+
+        private GUIFloatField limitExtentField = new GUIFloatField(new LocEdString("Extent"));
+        private LimitCommonGUI limitCommonGUI;
+
+        public Action<LimitLinearData, LimitCommonData> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current limit properties.
+        /// </summary>
+        public LimitLinear Limit
+        {
+            set
+            {
+                limitData = value.Data;
+
+                limitExtentField.Value = limitData.extent;
+                limitCommonGUI.LimitData = value.CommonData;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the limit object.
+        /// </summary>
+        /// <param name="limit">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public LimitLinearGUI(LimitLinear limit, GUILayout layout, SerializableProperties properties)
+        {
+            this.limitData = limit.Data;
+
+            limitExtentField.OnChanged += x => { limitData.extent = x; MarkAsModified(); };
+            limitExtentField.OnFocusLost += ConfirmModify;
+
+            layout.AddElement(limitExtentField);
+            limitCommonGUI = new LimitCommonGUI("linear", limit.CommonData, layout, properties);
+            limitCommonGUI.OnChanged += x => MarkAsModified();
+            limitCommonGUI.OnConfirmed += ConfirmModify;
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(limitData, limitCommonGUI.LimitData);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+    }
+
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="LimitLinearRange"/> object.
+    /// </summary>
+    internal class LimitLinearRangeGUI
+    {
+        private LimitLinearRangeData limitData;
+
+        private GUIFloatField limitLowerField = new GUIFloatField(new LocEdString("Lower"));
+        private GUIFloatField limitUpperField = new GUIFloatField(new LocEdString("Upper"));
+        private LimitCommonGUI limitCommonGUI;
+
+        public Action<LimitLinearRangeData, LimitCommonData> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current limit properties.
+        /// </summary>
+        public LimitLinearRange Limit
+        {
+            set
+            {
+                limitData = value.Data;
+
+                limitLowerField.Value = limitData.lower;
+                limitUpperField.Value = limitData.upper;
+                limitCommonGUI.LimitData = value.CommonData;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the limit object.
+        /// </summary>
+        /// <param name="limit">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public LimitLinearRangeGUI(LimitLinearRange limit, GUILayout layout, SerializableProperties properties)
+        {
+            this.limitData = limit.Data;
+
+            limitLowerField.OnChanged += x => { limitData.lower = x; MarkAsModified(); };
+            limitLowerField.OnFocusLost += ConfirmModify;
+
+            limitUpperField.OnChanged += x => { limitData.upper = x; MarkAsModified(); };
+            limitUpperField.OnFocusLost += ConfirmModify;
+
+            layout.AddElement(limitLowerField);
+            layout.AddElement(limitUpperField);
+            limitCommonGUI = new LimitCommonGUI("linearRange", limit.CommonData, layout, properties);
+            limitCommonGUI.OnChanged += x => MarkAsModified();
+            limitCommonGUI.OnConfirmed += ConfirmModify;
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(limitData, limitCommonGUI.LimitData);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+    }
+
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="LimitAngularRange"/> object.
+    /// </summary>
+    internal class LimitAngularRangeGUI
+    {
+        private LimitAngularRangeData limitData;
+
+        private GUISliderField limitLowerField = new GUISliderField(0, 359, new LocEdString("Lower"));
+        private GUISliderField limitUpperField = new GUISliderField(0, 359, new LocEdString("Upper"));
+        private LimitCommonGUI limitCommonGUI;
+
+        public Action<LimitAngularRangeData, LimitCommonData> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current limit properties.
+        /// </summary>
+        public LimitAngularRange Limit
+        {
+            set
+            {
+                limitData = value.Data;
+
+                limitLowerField.Value = limitData.lower.Degrees;
+                limitUpperField.Value = limitData.upper.Degrees;
+                limitCommonGUI.LimitData = value.CommonData;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the limit object.
+        /// </summary>
+        /// <param name="limit">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public LimitAngularRangeGUI(LimitAngularRange limit, GUILayout layout, SerializableProperties properties)
+        {
+            this.limitData = limit.Data;
+
+            limitLowerField.OnChanged += x => { limitData.lower = new Degree(x); MarkAsModified(); };
+            limitLowerField.OnFocusLost += ConfirmModify;
+
+            limitUpperField.OnChanged += x => { limitData.upper = new Degree(x); MarkAsModified(); };
+            limitUpperField.OnFocusLost += ConfirmModify;
+
+            layout.AddElement(limitLowerField);
+            layout.AddElement(limitUpperField);
+            limitCommonGUI = new LimitCommonGUI("angularRange", limit.CommonData, layout, properties);
+            limitCommonGUI.OnChanged += x => MarkAsModified();
+            limitCommonGUI.OnConfirmed += ConfirmModify;
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(limitData, limitCommonGUI.LimitData);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+    }
+
+    /// <summary>
+    /// Draws GUI elements for inspecting an <see cref="LimitConeRange"/> object.
+    /// </summary>
+    internal class LimitConeRangeGUI
+    {
+        private LimitConeRangeData limitData;
+
+        private GUISliderField yLimitAngleField = new GUISliderField(0, 180, new LocEdString("Y limit"));
+        private GUISliderField zLimitAngleField = new GUISliderField(0, 180, new LocEdString("Z limit"));
+        private LimitCommonGUI limitCommonGUI;
+
+        public Action<LimitConeRangeData, LimitCommonData> OnChanged;
+        public Action OnConfirmed;
+
+        /// <summary>
+        /// Current limit properties.
+        /// </summary>
+        public LimitConeRange Limit
+        {
+            set
+            {
+                limitData = value.Data;
+
+                yLimitAngleField.Value = limitData.yLimitAngle.Degrees;
+                zLimitAngleField.Value = limitData.zLimitAngle.Degrees;
+                limitCommonGUI.LimitData = value.CommonData;
+            }
+        }
+
+        /// <summary>
+        /// Constructs a new set of GUI elements for inspecting the limit object.
+        /// </summary>
+        /// <param name="limit">Initial values to assign to the GUI elements.</param>
+        /// <param name="layout">Layout to append the GUI elements to.</param>
+        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
+        ///                          </param>
+        public LimitConeRangeGUI(LimitConeRange limit, GUILayout layout, SerializableProperties properties)
+        {
+            this.limitData = limit.Data;
+
+            yLimitAngleField.OnChanged += x => { limitData.yLimitAngle = new Degree(x); MarkAsModified(); };
+            yLimitAngleField.OnFocusLost += ConfirmModify;
+
+            zLimitAngleField.OnChanged += x => { limitData.zLimitAngle = new Degree(x); MarkAsModified(); };
+            zLimitAngleField.OnFocusLost += ConfirmModify;
+
+            layout.AddElement(yLimitAngleField);
+            layout.AddElement(zLimitAngleField);
+            limitCommonGUI = new LimitCommonGUI("coneRange", limit.CommonData, layout, properties);
+            limitCommonGUI.OnChanged += x => MarkAsModified();
+            limitCommonGUI.OnConfirmed += ConfirmModify;
+        }
+
+        /// <summary>
+        /// Marks the contents of the inspector as modified.
+        /// </summary>
+        private void MarkAsModified()
+        {
+            if (OnChanged != null)
+                OnChanged(limitData, limitCommonGUI.LimitData);
+        }
+
+        /// <summary>
+        /// Confirms any queued modifications.
+        /// </summary>
+        private void ConfirmModify()
+        {
+            if (OnConfirmed != null)
+                OnConfirmed();
+        }
+    }
 }
 }

+ 64 - 31
Source/MBansheeEditor/Scene/Gizmos/JointGizmos.cs

@@ -78,6 +78,8 @@ namespace BansheeEditor
             if (joint.EnableMinDistanceLimit)
             if (joint.EnableMinDistanceLimit)
             {
             {
                 min = MathEx.Max(0.0f, joint.MinDistance);
                 min = MathEx.Max(0.0f, joint.MinDistance);
+                if (joint.EnableMaxDistanceLimit)
+                    min = MathEx.Min(min, MathEx.Min(10000.0f, joint.MaxDistance));
 
 
                 Gizmos.DrawLine(center - normal*min*0.5f, center + normal*min*0.5f);
                 Gizmos.DrawLine(center - normal*min*0.5f, center + normal*min*0.5f);
             }
             }
@@ -85,9 +87,14 @@ namespace BansheeEditor
             if (joint.EnableMaxDistanceLimit)
             if (joint.EnableMaxDistanceLimit)
             {
             {
                 max = MathEx.Min(10000.0f, joint.MaxDistance);
                 max = MathEx.Min(10000.0f, joint.MaxDistance);
+                if (joint.EnableMinDistanceLimit)
+                    max = MathEx.Max(max, min);
 
 
-                Gizmos.DrawLine(center - normal * max * 0.5f, center - normal * length * 0.5f);
-                Gizmos.DrawLine(center + normal * max * 0.5f, center + normal * length * 0.5f);
+                if (length > max)
+                {
+                    Gizmos.DrawLine(center - normal*max*0.5f, center - normal*length*0.5f);
+                    Gizmos.DrawLine(center + normal*max*0.5f, center + normal*length*0.5f);
+                }
             }
             }
 
 
             Gizmos.Color = Color.Green;
             Gizmos.Color = Color.Green;
@@ -123,13 +130,17 @@ namespace BansheeEditor
             {
             {
                 LimitLinearRange limit = joint.Limit;
                 LimitLinearRange limit = joint.Limit;
 
 
-                min = MathEx.Max(0.0f, limit.Lower);
-                Gizmos.DrawLine(center - normal * min * 0.5f, center + normal * min * 0.5f);
-
                 max = MathEx.Min(10000.0f, limit.Upper);
                 max = MathEx.Min(10000.0f, limit.Upper);
+                min = MathEx.Clamp(limit.Lower, 0.0f, max);
+                max = MathEx.Max(max, min);
+
+                Gizmos.DrawLine(center - normal * min * 0.5f, center + normal * min * 0.5f);
 
 
-                Gizmos.DrawLine(center - normal * max * 0.5f, center - normal * length * 0.5f);
-                Gizmos.DrawLine(center + normal * max * 0.5f, center + normal * length * 0.5f);
+                if (length > max)
+                {
+                    Gizmos.DrawLine(center - normal*max*0.5f, center - normal*length*0.5f);
+                    Gizmos.DrawLine(center + normal*max*0.5f, center + normal*length*0.5f);
+                }
             }
             }
 
 
             Gizmos.Color = Color.Green;
             Gizmos.Color = Color.Green;
@@ -156,16 +167,27 @@ namespace BansheeEditor
             {
             {
                 LimitConeRange limit = joint.Limit;
                 LimitConeRange limit = joint.Limit;
 
 
-                Vector2 scale;
-                scale.x = MathEx.Cos(limit.ZLimitAngle * 0.5f);
-                scale.y = MathEx.Cos(limit.YLimitAngle * 0.5f);
+                Radian zAngle = MathEx.Min(new Degree(360), limit.ZLimitAngle*2.0f);
+                Radian yAngle = MathEx.Min(new Degree(360), limit.YLimitAngle*2.0f);
 
 
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
-                Gizmos.DrawCone(Vector3.Zero, Vector3.XAxis, 1.0f, 1.0f, scale);
+                Gizmos.DrawWireArc(Vector3.Zero, Vector3.ZAxis, 0.25f, zAngle * -0.5f, zAngle);
+                Gizmos.DrawWireArc(Vector3.Zero, Vector3.YAxis, 0.25f, yAngle * -0.5f, yAngle);
+
+                Gizmos.Color = Color.Red;
+                Radian remainingZAngle = new Degree(360) - zAngle;
+                Radian remainingYAngle = new Degree(360) - yAngle;
+
+                Gizmos.DrawWireArc(Vector3.Zero, Vector3.ZAxis, 0.25f, zAngle * 0.5f, remainingZAngle);
+                Gizmos.DrawWireArc(Vector3.Zero, Vector3.YAxis, 0.25f, yAngle * 0.5f, remainingYAngle);
             }
             }
             else
             else
             {
             {
-                Gizmos.DrawWireSphere(joint.SceneObject.Position, 1.0f);
+                Gizmos.Color = Color.Green;
+                Gizmos.Transform = joint.SceneObject.WorldTransform;
+
+                Gizmos.DrawWireDisc(Vector3.Zero, Vector3.ZAxis, 0.25f);
+                Gizmos.DrawWireDisc(Vector3.Zero, Vector3.YAxis, 0.25f);
             }
             }
         }
         }
 
 
@@ -183,6 +205,9 @@ namespace BansheeEditor
             Gizmos.DrawSphere(anchorA, 0.05f);
             Gizmos.DrawSphere(anchorA, 0.05f);
             Gizmos.DrawSphere(anchorB, 0.05f);
             Gizmos.DrawSphere(anchorB, 0.05f);
 
 
+            const float radius = 0.05f;
+            const float height = 0.25f;
+
             if (joint.EnableLimit)
             if (joint.EnableLimit)
             {
             {
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
@@ -191,48 +216,56 @@ namespace BansheeEditor
 
 
                 Action<float> drawLimitedArc = x =>
                 Action<float> drawLimitedArc = x =>
                 {
                 {
+                    Degree lower = MathEx.WrapAngle(limit.Lower);
+                    Degree upper = MathEx.WrapAngle(limit.Upper);
+
+                    lower = MathEx.Min(lower, upper);
+                    upper = MathEx.Max(lower, upper);
+
                     // Arc zero to lower limit
                     // Arc zero to lower limit
                     Gizmos.Color = Color.Red;
                     Gizmos.Color = Color.Red;
-                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, 0.25f, -limit.Lower * 0.5f, limit.Lower);
+                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, radius, lower * -0.5f, lower);
 
 
                     // Arc lower to upper limit
                     // Arc lower to upper limit
-                    Degree validRange = limit.Upper - limit.Lower;
+                    Degree validRange = upper - lower;
 
 
                     Gizmos.Color = Color.Green;
                     Gizmos.Color = Color.Green;
-                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, 0.25f, -limit.Lower - validRange * 0.5f, validRange * 0.5f);
-                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, 0.25f, limit.Lower * 0.5f, validRange * 0.5f);
+                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, radius, (lower + validRange) * -0.5f, validRange * 0.5f);
+                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, radius, lower * 0.5f, validRange * 0.5f);
 
 
                     // Arc upper to full circle
                     // Arc upper to full circle
-                    Degree remainingRange = new Degree(360) - MathEx.WrapAngle(limit.Upper);
+                    Degree remainingRange = new Degree(360) - upper;
 
 
-                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, 0.25f, -limit.Upper - remainingRange * 0.5f, remainingRange * 0.5f);
-                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, 0.25f, limit.Upper * 0.5f, remainingRange * 0.5f);
+                    Gizmos.Color = Color.Red;
+                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, radius, (upper + remainingRange) * -0.5f, remainingRange * 0.5f);
+                    Gizmos.DrawWireArc(Vector3.XAxis * x, Vector3.XAxis, radius, upper * 0.5f, remainingRange * 0.5f);
                 };
                 };
 
 
-                drawLimitedArc(-0.5f);
-                drawLimitedArc(0.5f);
+                drawLimitedArc(-height);
+                drawLimitedArc(height);
             }
             }
             else
             else
             {
             {
                 Gizmos.Color = Color.Green;
                 Gizmos.Color = Color.Green;
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
                 Gizmos.Transform = joint.SceneObject.WorldTransform;
 
 
-                Gizmos.DrawWireDisc(Vector3.XAxis * -0.5f, Vector3.XAxis, 0.25f);
-                Gizmos.DrawWireDisc(Vector3.XAxis * 0.5f, Vector3.XAxis, 0.25f);
+                Gizmos.DrawWireDisc(Vector3.XAxis * -height, Vector3.XAxis, radius);
+                Gizmos.DrawWireDisc(Vector3.XAxis * height, Vector3.XAxis, radius);
             }
             }
 
 
             Vector3[] lineStartPoints = new Vector3[4];
             Vector3[] lineStartPoints = new Vector3[4];
-            lineStartPoints[0] = new Vector3(-0.5f, 0.25f, 0.25f);
-            lineStartPoints[1] = new Vector3(-0.5f, 0.25f, -0.25f);
-            lineStartPoints[2] = new Vector3(-0.5f, -0.25f, 0.25f);
-            lineStartPoints[3] = new Vector3(-0.5f, -0.25f, -0.25f);
+            lineStartPoints[0] = new Vector3(-height, radius, 0);
+            lineStartPoints[1] = new Vector3(-height, -radius, 0);
+            lineStartPoints[2] = new Vector3(-height, 0, radius);
+            lineStartPoints[3] = new Vector3(-height, 0, -radius);
 
 
             Vector3[] lineEndPoints = new Vector3[4];
             Vector3[] lineEndPoints = new Vector3[4];
-            lineEndPoints[0] = new Vector3(0.5f, 0.25f, 0.25f);
-            lineEndPoints[1] = new Vector3(0.5f, 0.25f, -0.25f);
-            lineEndPoints[2] = new Vector3(0.5f, -0.25f, 0.25f);
-            lineEndPoints[3] = new Vector3(0.5f, -0.25f, -0.25f);
+            lineEndPoints[0] = new Vector3(height, radius, 0);
+            lineEndPoints[1] = new Vector3(height, -radius, 0);
+            lineEndPoints[2] = new Vector3(height, 0, radius);
+            lineEndPoints[3] = new Vector3(height, 0, -radius);
 
 
+            Gizmos.Color = Color.Green;
             for (int i = 0; i < 4; i++)
             for (int i = 0; i < 4; i++)
                 Gizmos.DrawLine(lineStartPoints[i], lineEndPoints[i]);
                 Gizmos.DrawLine(lineStartPoints[i], lineEndPoints[i]);
         }
         }

+ 7 - 7
Source/MBansheeEditor/Scene/RotateHandle.cs

@@ -126,7 +126,7 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.Color = Color.Red;
                 HandleDrawing.Color = Color.Red;
 
 
-            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.XAxis, 1.0f, GetXStartAngle(false), new Degree(-180.0f), handleSize);
+            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.XAxis, 1.0f, GetXStartAngle(false), new Degree(180.0f), handleSize);
 
 
             if (yAxis.State == HandleSlider.StateType.Active)
             if (yAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.Color = Color.White;
                 HandleDrawing.Color = Color.White;
@@ -135,7 +135,7 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.Color = Color.Green;
                 HandleDrawing.Color = Color.Green;
 
 
-            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.YAxis, 1.0f, GetYStartAngle(false), new Degree(-180.0f), handleSize);
+            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.YAxis, 1.0f, GetYStartAngle(false), new Degree(180.0f), handleSize);
 
 
             if (zAxis.State == HandleSlider.StateType.Active)
             if (zAxis.State == HandleSlider.StateType.Active)
                 HandleDrawing.Color = Color.White;
                 HandleDrawing.Color = Color.White;
@@ -144,7 +144,7 @@ namespace BansheeEditor
             else
             else
                 HandleDrawing.Color = Color.Blue;
                 HandleDrawing.Color = Color.Blue;
 
 
-            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.ZAxis, 1.0f, GetZStartAngle(false), new Degree(-180.0f), handleSize);
+            HandleDrawing.DrawWireArc(Vector3.Zero, Vector3.ZAxis, 1.0f, GetZStartAngle(false), new Degree(180.0f), handleSize);
 
 
             // Draw "bounds" and free handle
             // Draw "bounds" and free handle
             Color gray = new Color(1.0f, 1.0f, 1.0f, 0.3f);
             Color gray = new Color(1.0f, 1.0f, 1.0f, 0.3f);
@@ -168,16 +168,16 @@ namespace BansheeEditor
             HandleDrawing.Transform = Matrix4.TRS(Position, EditorApplication.SceneViewCamera.SceneObject.Rotation, Vector3.One);
             HandleDrawing.Transform = Matrix4.TRS(Position, EditorApplication.SceneViewCamera.SceneObject.Rotation, Vector3.One);
 
 
             if (freeAxis.State == HandleSlider.StateType.Active)
             if (freeAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.DrawArc(Vector3.Zero, -Vector3.ZAxis, 1.2f, freeAxis.StartAngle, freeAxis.Delta, handleSize);
+                HandleDrawing.DrawArc(Vector3.Zero, -Vector3.ZAxis, 1.2f, freeAxis.StartAngle, -freeAxis.Delta, handleSize);
 
 
             HandleDrawing.Transform = Matrix4.TRS(Position, dragStartRotation, Vector3.One);
             HandleDrawing.Transform = Matrix4.TRS(Position, dragStartRotation, Vector3.One);
 
 
             if (xAxis.State == HandleSlider.StateType.Active)
             if (xAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.DrawArc(Vector3.Zero, Vector3.XAxis, 1.0f, xAxis.StartAngle, xAxis.Delta, handleSize);
+                HandleDrawing.DrawArc(Vector3.Zero, Vector3.XAxis, 1.0f, xAxis.StartAngle, -xAxis.Delta, handleSize);
             else if (yAxis.State == HandleSlider.StateType.Active)
             else if (yAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.DrawArc(Vector3.Zero, Vector3.YAxis, 1.0f, yAxis.StartAngle, yAxis.Delta, handleSize);
+                HandleDrawing.DrawArc(Vector3.Zero, Vector3.YAxis, 1.0f, yAxis.StartAngle, -yAxis.Delta, handleSize);
             else if (zAxis.State == HandleSlider.StateType.Active)
             else if (zAxis.State == HandleSlider.StateType.Active)
-                HandleDrawing.DrawArc(Vector3.Zero, Vector3.ZAxis, 1.0f, zAxis.StartAngle, zAxis.Delta, handleSize);
+                HandleDrawing.DrawArc(Vector3.Zero, Vector3.ZAxis, 1.0f, zAxis.StartAngle, -zAxis.Delta, handleSize);
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 28 - 0
Source/MBansheeEngine/Math/MathEx.cs

@@ -96,6 +96,20 @@ namespace BansheeEngine
             return b;
             return b;
         }
         }
 
 
+        /// <summary>
+        /// Returns the minimum value of the two provided.
+        /// </summary>
+        /// <param name="a">First value to compare.</param>
+        /// <param name="b">Second value to compare.</param>
+        /// <returns>Minimum of the two values.</returns>
+        public static Radian Min(Radian a, Radian b)
+        {
+            if (a < b)
+                return a;
+
+            return b;
+        }
+
         /// <summary>
         /// <summary>
         /// Returns the minimum value of all the values provided.
         /// Returns the minimum value of all the values provided.
         /// </summary>
         /// </summary>
@@ -166,6 +180,20 @@ namespace BansheeEngine
                 return b;
                 return b;
         }
         }
 
 
+        /// <summary>
+        /// Returns the maximum value of the two provided.
+        /// </summary>
+        /// <param name="a">First value to compare.</param>
+        /// <param name="b">Second value to compare.</param>
+        /// <returns>Maximum of the two values.</returns>
+        public static Radian Max(Radian a, Radian b)
+        {
+            if (a > b)
+                return a;
+            else
+                return b;
+        }
+
         /// <summary>
         /// <summary>
         /// Returns the maximum value of all the values provided.
         /// Returns the maximum value of all the values provided.
         /// </summary>
         /// </summary>

+ 6 - 6
Source/SBansheeEngine/Source/BsScriptJointCommon.cpp

@@ -15,7 +15,7 @@ namespace BansheeEngine
 
 
 	void ScriptD6JointDrive::initRuntimeData()
 	void ScriptD6JointDrive::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	D6Joint::Drive ScriptD6JointDrive::convert(MonoObject* instance)
 	D6Joint::Drive ScriptD6JointDrive::convert(MonoObject* instance)
@@ -35,7 +35,7 @@ namespace BansheeEngine
 
 
 	void ScriptHingeJointDrive::initRuntimeData()
 	void ScriptHingeJointDrive::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	HingeJoint::Drive ScriptHingeJointDrive::convert(MonoObject* instance)
 	HingeJoint::Drive ScriptHingeJointDrive::convert(MonoObject* instance)
@@ -55,7 +55,7 @@ namespace BansheeEngine
 
 
 	void ScriptLimitLinearRange::initRuntimeData()
 	void ScriptLimitLinearRange::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	LimitLinearRange ScriptLimitLinearRange::convert(MonoObject* instance)
 	LimitLinearRange ScriptLimitLinearRange::convert(MonoObject* instance)
@@ -75,7 +75,7 @@ namespace BansheeEngine
 
 
 	void ScriptLimitLinear::initRuntimeData()
 	void ScriptLimitLinear::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	LimitLinear ScriptLimitLinear::convert(MonoObject* instance)
 	LimitLinear ScriptLimitLinear::convert(MonoObject* instance)
@@ -95,7 +95,7 @@ namespace BansheeEngine
 
 
 	void ScriptLimitAngularRange::initRuntimeData()
 	void ScriptLimitAngularRange::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	LimitAngularRange ScriptLimitAngularRange::convert(MonoObject* instance)
 	LimitAngularRange ScriptLimitAngularRange::convert(MonoObject* instance)
@@ -115,7 +115,7 @@ namespace BansheeEngine
 
 
 	void ScriptLimitConeRange::initRuntimeData()
 	void ScriptLimitConeRange::initRuntimeData()
 	{
 	{
-		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative", 1)->getThunk();
+		getNativeDataThunk = (GetNativeDataThunkDef)metaData.scriptClass->getMethod("Internal_GetNative")->getThunk();
 	}
 	}
 
 
 	LimitConeRange ScriptLimitConeRange::convert(MonoObject* instance)
 	LimitConeRange ScriptLimitConeRange::convert(MonoObject* instance)