Added KCC

This commit is contained in:
nothke
2024-08-17 00:50:47 +02:00
parent 7099af3fe2
commit 6720e05750
42 changed files with 5061 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
{
"name": "KCC.Editor",
"references": [
"GUID:1bf68a6e05395544c9eb0c8d1ab94588"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

View File

@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 8b7c931d99dfb09428a98748ecfd6169
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,28 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
namespace KinematicCharacterController
{
[CustomEditor(typeof(KinematicCharacterMotor))]
public class KinematicCharacterMotorEditor : Editor
{
protected virtual void OnSceneGUI()
{
KinematicCharacterMotor motor = (target as KinematicCharacterMotor);
if (motor)
{
Vector3 characterBottom = motor.transform.position + (motor.Capsule.center + (-Vector3.up * (motor.Capsule.height * 0.5f)));
Handles.color = Color.yellow;
Handles.CircleHandleCap(
0,
characterBottom + (motor.transform.up * motor.MaxStepHeight),
Quaternion.LookRotation(motor.transform.up, motor.transform.forward),
motor.Capsule.radius + 0.1f,
EventType.Repaint);
}
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 7db3ed6d74cbf2b489cab5e1586bed7a
timeCreated: 1518400757
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,21 @@
using UnityEngine;
using UnityEditor;
namespace KinematicCharacterController
{
[CustomPropertyDrawer(typeof(ReadOnlyAttribute))]
public class ReadOnlyPropertyDrawer : PropertyDrawer
{
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return EditorGUI.GetPropertyHeight(property, label, true);
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
GUI.enabled = false;
EditorGUI.PropertyField(position, property, label, true);
GUI.enabled = true;
}
}
}

View File

@@ -0,0 +1,13 @@
fileFormatVersion: 2
guid: 0d4351ab88853824b85a8f458928d825
timeCreated: 1504492796
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: