private static void PhysicsPopup(int labelWidth, RageSpline rageSpline, bool showMeshColliderWarning) { EditorGUIUtility.LookLikeControls(80f, 90f); RageSpline.Physics oldPhysics = rageSpline.GetPhysics(); bool oldCreatePhysicsInEditor = rageSpline.GetCreatePhysicsInEditor(); rageSpline.SetPhysics ((RageSpline.Physics) EditorGUILayout.EnumPopup (" Physics:", rageSpline.GetPhysics(), GUILayout.Width (labelWidth))); EditorGUIUtility.LookLikeControls(170f, 10f); switch (rageSpline.GetPhysics()) { case RageSpline.Physics.None: break; case RageSpline.Physics.MeshCollider: case RageSpline.Physics.OutlineMeshCollider: physicsOptions = EditorGUILayout.Foldout(physicsOptions, " Physics Options"); if (physicsOptions) { rageSpline.LockPhysicsToAppearence = EditorGUILayout.Toggle(" Lock to Appearance", rageSpline.LockPhysicsToAppearence); if (!rageSpline.LockPhysicsToAppearence) { rageSpline.SetPhysicsColliderCount(EditorGUILayout.IntField(" Physics split count", rageSpline.GetPhysicsColliderCount())); } rageSpline.SetPhysicsZDepth(EditorGUILayout.FloatField(" Physics z-depth", rageSpline.GetPhysicsZDepth())); if (rageSpline.GetPhysics() != RageSpline.Physics.OutlineMeshCollider) rageSpline.SetPhysicsNormalOffset(EditorGUILayout.FloatField(" Physics normal offset", rageSpline.GetPhysicsNormalOffset())); rageSpline.SetPhysicsMaterial(EditorGUILayout.ObjectField(" Physics material", rageSpline.GetPhysicsMaterial(), typeof(PhysicMaterial), false) as PhysicMaterial); if (rageSpline.GetPhysics() != RageSpline.Physics.OutlineMeshCollider) rageSpline.SetCreateConvexMeshCollider(EditorGUILayout.Toggle(" Physics convex", rageSpline.GetCreateConvexMeshCollider())); rageSpline.SetCreatePhysicsInEditor(EditorGUILayout.Toggle(" Physics editor creation", rageSpline.GetCreatePhysicsInEditor())); } break; case RageSpline.Physics.Boxed: physicsOptions = EditorGUILayout.Foldout(physicsOptions, " Physics Options"); if (physicsOptions) { rageSpline.LockPhysicsToAppearence = EditorGUILayout.Toggle(" Lock to Appearance", rageSpline.LockPhysicsToAppearence); if (!rageSpline.LockPhysicsToAppearence) { rageSpline.SetPhysicsColliderCount(EditorGUILayout.IntField(" Physics split count", rageSpline.GetPhysicsColliderCount())); rageSpline.SetPhysicsZDepth(EditorGUILayout.FloatField(" Physics z-depth", rageSpline.GetPhysicsZDepth())); rageSpline.SetPhysicsNormalOffset(EditorGUILayout.FloatField(" Physics offset", rageSpline.GetPhysicsNormalOffset())); rageSpline.SetBoxColliderDepth(EditorGUILayout.FloatField(" Physics normal depth", rageSpline.GetBoxColliderDepth())); } rageSpline.SetPhysicsMaterial( EditorGUILayout.ObjectField(" Physics material", rageSpline.GetPhysicsMaterial(), typeof (PhysicMaterial), false) as PhysicMaterial); rageSpline.SetCreatePhysicsInEditor(EditorGUILayout.Toggle(" Physics editor creation", rageSpline.GetCreatePhysicsInEditor())); } break; case RageSpline.Physics.Farseer: rageSpline.SetCreatePhysicsInEditor(EditorGUILayout.Toggle(" Physics editor creation", rageSpline.GetCreatePhysicsInEditor())); physicsOptions = EditorGUILayout.Foldout(physicsOptions, " Physics Options"); if (physicsOptions) { rageSpline.FarseerPhysicsPointsOnly = EditorGUILayout.Toggle(" Use points only", rageSpline.FarseerPhysicsPointsOnly); if (!rageSpline.FarseerPhysicsPointsOnly) { rageSpline.LockPhysicsToAppearence = EditorGUILayout.Toggle(" Lock to Appearance", rageSpline.LockPhysicsToAppearence); if (!rageSpline.LockPhysicsToAppearence) { rageSpline.SetPhysicsColliderCount(EditorGUILayout.IntField(" Physics split count", rageSpline.GetPhysicsColliderCount())); rageSpline.SetPhysicsNormalOffset(EditorGUILayout.FloatField(" Physics offset", rageSpline.GetPhysicsNormalOffset())); } } } break; } EditorGUILayout.Separator(); if (showMeshColliderWarning) { if (rageSpline.GetPhysics() != RageSpline.Physics.MeshCollider && oldPhysics == RageSpline.Physics.MeshCollider && rageSpline.GetCreatePhysicsInEditor() || rageSpline.GetPhysics() == RageSpline.Physics.MeshCollider && oldCreatePhysicsInEditor && !rageSpline.GetCreatePhysicsInEditor()) { var meshCollider = rageSpline.gameObject.GetComponent<MeshCollider>(); if (meshCollider != null) Debug.Log("RageSpline warning: Please remove the Mesh Collider component from the GameObject '" + rageSpline.gameObject.name + "' manually. This warning can be disabled from the RageSpline/Code/RageSplineEditor.cs line 13."); } } }