working on fpp locomotion, camera spring

This commit is contained in:
2025-06-07 10:39:06 +02:00
parent 0abddece7e
commit e99314d5d8
40 changed files with 4112 additions and 462 deletions

View File

@@ -1,279 +0,0 @@
[*]
charset = utf-8-bom
end_of_line = crlf
trim_trailing_whitespace = false
insert_final_newline = false
indent_style = space
indent_size = 4
# Microsoft .NET properties
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_object_initializers = false
csharp_new_line_before_open_brace = none
csharp_preferred_modifier_order = public, private, protected, internal, file, new, static, abstract, virtual, sealed, readonly, override, extern, unsafe, volatile, async, required:suggestion
csharp_space_after_cast = true
csharp_style_prefer_utf8_string_literals = true:suggestion
csharp_style_var_elsewhere = false:suggestion
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:suggestion
dotnet_naming_rule.constants_rule.import_to_resharper = True
dotnet_naming_rule.constants_rule.resharper_description = Constant fields (not private)
dotnet_naming_rule.constants_rule.resharper_guid = 669e5282-fb4b-4e90-91e7-07d269d04b60
dotnet_naming_rule.constants_rule.severity = none
dotnet_naming_rule.constants_rule.style = all_upper_style
dotnet_naming_rule.constants_rule.symbols = constants_symbols
dotnet_naming_rule.interfaces_rule.import_to_resharper = True
dotnet_naming_rule.interfaces_rule.resharper_description = Interfaces
dotnet_naming_rule.interfaces_rule.resharper_guid = a7a3339e-4e89-4319-9735-a9dc4cb74cc7
dotnet_naming_rule.interfaces_rule.severity = none
dotnet_naming_rule.interfaces_rule.style = i_upper_camel_case_style
dotnet_naming_rule.interfaces_rule.symbols = interfaces_symbols
dotnet_naming_rule.private_constants_rule.import_to_resharper = True
dotnet_naming_rule.private_constants_rule.resharper_description = Constant fields (private)
dotnet_naming_rule.private_constants_rule.resharper_guid = 236f7aa5-7b06-43ca-bf2a-9b31bfcff09a
dotnet_naming_rule.private_constants_rule.resharper_style = k_ + AaBb, AA_BB
dotnet_naming_rule.private_constants_rule.severity = none
dotnet_naming_rule.private_constants_rule.style = k_upper_camel_case_style
dotnet_naming_rule.private_constants_rule.symbols = private_constants_symbols
dotnet_naming_rule.private_instance_fields_rule.import_to_resharper = True
dotnet_naming_rule.private_instance_fields_rule.resharper_description = Instance fields (private)
dotnet_naming_rule.private_instance_fields_rule.resharper_guid = 4a98fdf6-7d98-4f5a-afeb-ea44ad98c70c
dotnet_naming_rule.private_instance_fields_rule.resharper_style = _ + aaBb, aaBb
dotnet_naming_rule.private_instance_fields_rule.severity = none
dotnet_naming_rule.private_instance_fields_rule.style = lower_camel_case_style_1
dotnet_naming_rule.private_instance_fields_rule.symbols = private_instance_fields_symbols
dotnet_naming_rule.private_static_fields_rule.import_to_resharper = True
dotnet_naming_rule.private_static_fields_rule.resharper_description = Static fields (private)
dotnet_naming_rule.private_static_fields_rule.resharper_guid = f9fce829-e6f4-4cb2-80f1-5497c44f51df
dotnet_naming_rule.private_static_fields_rule.severity = none
dotnet_naming_rule.private_static_fields_rule.style = s_lower_camel_case_style
dotnet_naming_rule.private_static_fields_rule.symbols = private_static_fields_symbols
dotnet_naming_rule.private_static_readonly_rule.import_to_resharper = True
dotnet_naming_rule.private_static_readonly_rule.resharper_description = Static readonly fields (private)
dotnet_naming_rule.private_static_readonly_rule.resharper_guid = 15b5b1f1-457c-4ca6-b278-5615aedc07d3
dotnet_naming_rule.private_static_readonly_rule.severity = none
dotnet_naming_rule.private_static_readonly_rule.style = all_upper_style
dotnet_naming_rule.private_static_readonly_rule.symbols = private_static_readonly_symbols
dotnet_naming_rule.public_fields_rule.import_to_resharper = True
dotnet_naming_rule.public_fields_rule.resharper_description = Instance fields (not private)
dotnet_naming_rule.public_fields_rule.resharper_guid = 53eecf85-d821-40e8-ac97-fdb734542b84
dotnet_naming_rule.public_fields_rule.severity = none
dotnet_naming_rule.public_fields_rule.style = lower_camel_case_style
dotnet_naming_rule.public_fields_rule.symbols = public_fields_symbols
dotnet_naming_rule.public_static_fields_rule.import_to_resharper = True
dotnet_naming_rule.public_static_fields_rule.resharper_description = Static fields (not private)
dotnet_naming_rule.public_static_fields_rule.resharper_guid = 70345118-4b40-4ece-937c-bbeb7a0b2e70
dotnet_naming_rule.public_static_fields_rule.severity = none
dotnet_naming_rule.public_static_fields_rule.style = s_upper_camel_case_underscore_tolerant_style
dotnet_naming_rule.public_static_fields_rule.symbols = public_static_fields_symbols
dotnet_naming_rule.static_readonly_rule.import_to_resharper = True
dotnet_naming_rule.static_readonly_rule.resharper_description = Static readonly fields (not private)
dotnet_naming_rule.static_readonly_rule.resharper_guid = c873eafb-d57f-481d-8c93-77f6863c2f88
dotnet_naming_rule.static_readonly_rule.severity = none
dotnet_naming_rule.static_readonly_rule.style = s_upper_camel_case_style
dotnet_naming_rule.static_readonly_rule.symbols = static_readonly_symbols
dotnet_naming_rule.type_parameters_rule.import_to_resharper = True
dotnet_naming_rule.type_parameters_rule.resharper_description = Type parameters
dotnet_naming_rule.type_parameters_rule.resharper_guid = 2c62818f-621b-4425-adc9-78611099bfcb
dotnet_naming_rule.type_parameters_rule.severity = none
dotnet_naming_rule.type_parameters_rule.style = t_upper_camel_case_style
dotnet_naming_rule.type_parameters_rule.symbols = type_parameters_symbols
dotnet_naming_rule.unity_serialized_field_private_rule.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_private_rule.resharper_description = Unity serialized field private
dotnet_naming_rule.unity_serialized_field_private_rule.resharper_guid = 4f5d02b8-10b8-49c3-a739-a3af9f6e120f
dotnet_naming_rule.unity_serialized_field_private_rule.severity = none
dotnet_naming_rule.unity_serialized_field_private_rule.style = m_upper_camel_case_style
dotnet_naming_rule.unity_serialized_field_private_rule.symbols = unity_serialized_field_private_symbols
dotnet_naming_rule.unity_serialized_field_rule.import_to_resharper = True
dotnet_naming_rule.unity_serialized_field_rule.resharper_description = Unity serialized field
dotnet_naming_rule.unity_serialized_field_rule.resharper_guid = 5f0fdb63-c892-4d2c-9324-15c80b22a7ef
dotnet_naming_rule.unity_serialized_field_rule.severity = none
dotnet_naming_rule.unity_serialized_field_rule.style = lower_camel_case_style
dotnet_naming_rule.unity_serialized_field_rule.symbols = unity_serialized_field_symbols
dotnet_naming_style.all_upper_style.capitalization = all_upper
dotnet_naming_style.all_upper_style.word_separator = _
dotnet_naming_style.i_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.i_upper_camel_case_style.required_prefix = I
dotnet_naming_style.k_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.k_upper_camel_case_style.required_prefix = k_
dotnet_naming_style.lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style_1.capitalization = camel_case
dotnet_naming_style.lower_camel_case_style_1.required_prefix = _
dotnet_naming_style.m_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.m_upper_camel_case_style.required_prefix = m_
dotnet_naming_style.s_lower_camel_case_style.capitalization = camel_case
dotnet_naming_style.s_lower_camel_case_style.required_prefix = s_
dotnet_naming_style.s_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.s_upper_camel_case_style.required_prefix = s_
dotnet_naming_style.s_upper_camel_case_underscore_tolerant_style.capitalization = pascal_case
dotnet_naming_style.s_upper_camel_case_underscore_tolerant_style.required_prefix = s_
dotnet_naming_style.s_upper_camel_case_underscore_tolerant_style.word_separator = _
dotnet_naming_style.t_upper_camel_case_style.capitalization = pascal_case
dotnet_naming_style.t_upper_camel_case_style.required_prefix = T
dotnet_naming_symbols.constants_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.constants_symbols.applicable_kinds = field
dotnet_naming_symbols.constants_symbols.required_modifiers = const
dotnet_naming_symbols.constants_symbols.resharper_applicable_kinds = constant_field
dotnet_naming_symbols.constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.interfaces_symbols.applicable_accessibilities = *
dotnet_naming_symbols.interfaces_symbols.applicable_kinds = interface
dotnet_naming_symbols.interfaces_symbols.resharper_applicable_kinds = interface
dotnet_naming_symbols.interfaces_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_constants_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_constants_symbols.applicable_kinds = field
dotnet_naming_symbols.private_constants_symbols.required_modifiers = const
dotnet_naming_symbols.private_constants_symbols.resharper_applicable_kinds = constant_field
dotnet_naming_symbols.private_constants_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.private_instance_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_instance_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_instance_fields_symbols.resharper_applicable_kinds = field,readonly_field
dotnet_naming_symbols.private_instance_fields_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.private_static_fields_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.private_static_fields_symbols.resharper_applicable_kinds = field
dotnet_naming_symbols.private_static_fields_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.private_static_readonly_symbols.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_symbols.required_modifiers = readonly,static
dotnet_naming_symbols.private_static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.private_static_readonly_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.public_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.public_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.public_fields_symbols.resharper_applicable_kinds = field,readonly_field
dotnet_naming_symbols.public_fields_symbols.resharper_required_modifiers = instance
dotnet_naming_symbols.public_static_fields_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.public_static_fields_symbols.applicable_kinds = field
dotnet_naming_symbols.public_static_fields_symbols.required_modifiers = static
dotnet_naming_symbols.public_static_fields_symbols.resharper_applicable_kinds = field
dotnet_naming_symbols.public_static_fields_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.static_readonly_symbols.applicable_accessibilities = public,internal,protected,protected_internal,private_protected
dotnet_naming_symbols.static_readonly_symbols.applicable_kinds = field
dotnet_naming_symbols.static_readonly_symbols.required_modifiers = readonly,static
dotnet_naming_symbols.static_readonly_symbols.resharper_applicable_kinds = readonly_field
dotnet_naming_symbols.static_readonly_symbols.resharper_required_modifiers = static
dotnet_naming_symbols.type_parameters_symbols.applicable_accessibilities = *
dotnet_naming_symbols.type_parameters_symbols.applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameters_symbols.resharper_applicable_kinds = type_parameter
dotnet_naming_symbols.type_parameters_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.unity_serialized_field_private_symbols.applicable_accessibilities = private,protected,protected_internal,private_protected
dotnet_naming_symbols.unity_serialized_field_private_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_private_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_private_symbols.resharper_required_modifiers = any
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_accessibilities = public,internal
dotnet_naming_symbols.unity_serialized_field_symbols.applicable_kinds =
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_applicable_kinds = unity_serialised_field
dotnet_naming_symbols.unity_serialized_field_symbols.resharper_required_modifiers = instance
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:none
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:none
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:none
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
dotnet_style_qualification_for_event = false:suggestion
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_require_accessibility_modifiers = omit_if_default:suggestion
# ReSharper properties
resharper_align_first_arg_by_paren = true
resharper_align_linq_query = true
resharper_align_multiline_argument = true
resharper_align_multiline_binary_expressions_chain = true
resharper_align_multiline_calls_chain = true
resharper_align_multiline_expression = true
resharper_align_multiline_expression_braces = true
resharper_align_multiline_extends_list = true
resharper_align_multiline_for_stmt = true
resharper_align_multiline_parameter = true
resharper_align_multiline_type_parameter_constraints = true
resharper_align_multiline_type_parameter_list = true
resharper_align_multiple_declaration = true
resharper_align_tuple_components = true
resharper_autodetect_indent_settings = true
resharper_continuous_line_indent = double
resharper_cpp_brace_style = next_line
resharper_cpp_int_align_comments = true
resharper_cpp_outdent_commas = true
resharper_cpp_wrap_lines = false
resharper_csharp_allow_far_alignment = true
resharper_csharp_wrap_lines = false
resharper_csharp_wrap_parameters_style = chop_if_long
resharper_formatter_off_tag = @formatter:off
resharper_formatter_on_tag = @formatter:on
resharper_formatter_tags_enabled = true
resharper_indent_nested_fixed_stmt = true
resharper_indent_nested_foreach_stmt = true
resharper_indent_nested_for_stmt = true
resharper_indent_nested_lock_stmt = true
resharper_indent_nested_usings_stmt = true
resharper_indent_nested_while_stmt = true
resharper_indent_preprocessor_directives = normal
resharper_indent_preprocessor_region = no_indent
resharper_int_align_enum_initializers = true
resharper_max_attribute_length_for_same_line = 70
resharper_new_line_before_while = false
resharper_outdent_statement_labels = true
resharper_place_accessorholder_attribute_on_same_line = false
resharper_place_field_attribute_on_same_line = if_owner_is_single_line
resharper_show_autodetect_configure_formatting_tip = false
resharper_space_within_single_line_array_initializer_braces = false
resharper_use_indent_from_vs = false
resharper_wrap_enum_declaration = chop_if_long
# ReSharper inspection severities
resharper_arrange_redundant_parentheses_highlighting = hint
resharper_arrange_this_qualifier_highlighting = hint
resharper_arrange_type_member_modifiers_highlighting = hint
resharper_arrange_type_modifiers_highlighting = hint
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
resharper_built_in_type_reference_style_highlighting = hint
resharper_cpp_parameter_names_mismatch_highlighting = none
resharper_cpp_use_auto_highlighting = none
resharper_inconsistent_naming_highlighting = none
resharper_mvc_action_not_resolved_highlighting = warning
resharper_mvc_area_not_resolved_highlighting = warning
resharper_mvc_controller_not_resolved_highlighting = warning
resharper_mvc_masterpage_not_resolved_highlighting = warning
resharper_mvc_partial_view_not_resolved_highlighting = warning
resharper_mvc_template_not_resolved_highlighting = warning
resharper_mvc_view_component_not_resolved_highlighting = warning
resharper_mvc_view_component_view_not_resolved_highlighting = warning
resharper_mvc_view_not_resolved_highlighting = warning
resharper_razor_assembly_not_resolved_highlighting = warning
resharper_redundant_base_qualifier_highlighting = warning
resharper_suggest_var_or_type_built_in_types_highlighting = hint
resharper_suggest_var_or_type_elsewhere_highlighting = hint
resharper_suggest_var_or_type_simple_types_highlighting = hint
resharper_use_index_from_end_expression_highlighting = none
resharper_web_config_module_not_resolved_highlighting = warning
resharper_web_config_type_not_resolved_highlighting = warning
resharper_web_config_wrong_module_highlighting = warning
[{*.yaml,*.yml}]
indent_style = space
indent_size = 2
[{*.har,*.json,*.jsonc}]
indent_style = space
indent_size = 2
[*.asmdef]
indent_style = space
indent_size = 2
[*.asmref]
indent_style = space
indent_size = 2
[*.inputactions]
indent_style = space
indent_size = 2
[*.{appxmanifest,asax,ascx,aspx,axaml,blockshader,build,c,c++,c++m,cc,ccm,cginc,compute,cp,cpp,cppm,cs,cshtml,cu,cuh,cxx,cxxm,dtd,fx,fxh,h,h++,hh,hlsl,hlsli,hlslinc,hp,hpp,hxx,icc,inc,inl,ino,ipp,ixx,master,mpp,mq4,mq5,mqh,mxx,nuspec,paml,razor,resw,resx,shader,shaderFoundry,skin,tcc,tpp,urtshader,usf,ush,uxml,vb,xaml,xamlx,xoml,xsd}]
indent_style = space
indent_size = 4
tab_width = 4

View File

@@ -43,11 +43,6 @@ MonoBehaviour:
m_ReadOnly: 0 m_ReadOnly: 0
m_SerializedLabels: [] m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0 FlaggedDuringContentUpdateRestriction: 0
- m_GUID: c5a555fd0308dc546b2a31af07869f90
m_Address: Assets/RebootKit/Runtime/FPPKit/Prefabs/FPPActor.prefab
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0 m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 93969247b34433f44bfa755967945828, type: 2} m_Settings: {fileID: 11400000, guid: 93969247b34433f44bfa755967945828, type: 2}
m_SchemaSet: m_SchemaSet:

View File

@@ -72,7 +72,7 @@
"name": "Next", "name": "Next",
"type": "Button", "type": "Button",
"id": "b7230bb6-fc9b-4f52-8b25-f5e19cb2c2ba", "id": "b7230bb6-fc9b-4f52-8b25-f5e19cb2c2ba",
"expectedControlType": "Button", "expectedControlType": "",
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false
@@ -81,7 +81,7 @@
"name": "Sprint", "name": "Sprint",
"type": "Button", "type": "Button",
"id": "641cd816-40e6-41b4-8c3d-04687c349290", "id": "641cd816-40e6-41b4-8c3d-04687c349290",
"expectedControlType": "Button", "expectedControlType": "",
"processors": "", "processors": "",
"interactions": "", "interactions": "",
"initialStateCheck": false "initialStateCheck": false

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0578aed1892493947879cf69c357bde0
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: aadf824e76564404c8d43d99803c60a1
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/APIReference.zip
uploadId: 505601

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: c8854cb84deea8146b0cc7833ff338fd
folderAsset: yes
timeCreated: 1499134826
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 220667f043f505a4eb52d0208e14818e
folderAsset: yes
timeCreated: 1504492780
licenseType: Store
DefaultImporter:
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,20 @@
fileFormatVersion: 2
guid: 7db3ed6d74cbf2b489cab5e1586bed7a
timeCreated: 1518400757
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/Editor/KinematicCharacterMotorEditor.cs
uploadId: 505601

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,20 @@
fileFormatVersion: 2
guid: 0d4351ab88853824b85a8f458928d825
timeCreated: 1504492796
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/Editor/ReadOnlyPropertyDrawer.cs
uploadId: 505601

View File

@@ -0,0 +1,50 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace KinematicCharacterController
{
public interface ICharacterController
{
/// <summary>
/// This is called when the motor wants to know what its rotation should be right now
/// </summary>
void UpdateRotation(ref Quaternion currentRotation, float deltaTime);
/// <summary>
/// This is called when the motor wants to know what its velocity should be right now
/// </summary>
void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime);
/// <summary>
/// This is called before the motor does anything
/// </summary>
void BeforeCharacterUpdate(float deltaTime);
/// <summary>
/// This is called after the motor has finished its ground probing, but before PhysicsMover/Velocity/etc.... handling
/// </summary>
void PostGroundingUpdate(float deltaTime);
/// <summary>
/// This is called after the motor has finished everything in its update
/// </summary>
void AfterCharacterUpdate(float deltaTime);
/// <summary>
/// This is called after when the motor wants to know if the collider can be collided with (or if we just go through it)
/// </summary>
bool IsColliderValidForCollisions(Collider coll);
/// <summary>
/// This is called when the motor's ground probing detects a ground hit
/// </summary>
void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport);
/// <summary>
/// This is called when the motor's movement logic detects a hit
/// </summary>
void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport);
/// <summary>
/// This is called after every move hit, to give you an opportunity to modify the HitStabilityReport to your liking
/// </summary>
void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, Vector3 atCharacterPosition, Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport);
/// <summary>
/// This is called when the character detects discrete collisions (collisions that don't result from the motor's capsuleCasts when moving)
/// </summary>
void OnDiscreteCollisionDetected(Collider hitCollider);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f13aa252bd3bf9943b1d65e68d93dcfb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/ICharacterController.cs
uploadId: 505601

View File

@@ -0,0 +1,14 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace KinematicCharacterController
{
public interface IMoverController
{
/// <summary>
/// This is called to let you tell the PhysicsMover where it should be right now
/// </summary>
void UpdateMovement(out Vector3 goalPosition, out Quaternion goalRotation, float deltaTime);
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8ae7eceec45f1be4c8450edc46c0ad36
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/IMoverController.cs
uploadId: 505601

View File

@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace KinematicCharacterController
{
[CreateAssetMenu]
public class KCCSettings : ScriptableObject
{
/// <summary>
/// Determines if the system simulates automatically.
/// If true, the simulation is done on FixedUpdate
/// </summary>
[Tooltip("Determines if the system simulates automatically. If true, the simulation is done on FixedUpdate")]
public bool AutoSimulation = true;
/// <summary>
/// Should interpolation of characters and PhysicsMovers be handled
/// </summary>
[Tooltip("Should interpolation of characters and PhysicsMovers be handled")]
public bool Interpolate = true;
/// <summary>
/// Initial capacity of the system's list of Motors (will resize automatically if needed, but setting a high initial capacity can help preventing GC allocs)
/// </summary>
[Tooltip("Initial capacity of the system's list of Motors (will resize automatically if needed, but setting a high initial capacity can help preventing GC allocs)")]
public int MotorsListInitialCapacity = 100;
/// <summary>
/// Initial capacity of the system's list of Movers (will resize automatically if needed, but setting a high initial capacity can help preventing GC allocs)
/// </summary>
[Tooltip("Initial capacity of the system's list of Movers (will resize automatically if needed, but setting a high initial capacity can help preventing GC allocs)")]
public int MoversListInitialCapacity = 100;
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2b43d8459fe4812488b2c47ac60e41c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/KCCSettings.cs
uploadId: 505601

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 4d1bc5515e3ab954e80599c538834774
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/KinematicCharacterMotor.cs
uploadId: 505601

View File

@@ -0,0 +1,294 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
namespace KinematicCharacterController
{
/// <summary>
/// The system that manages the simulation of KinematicCharacterMotor and PhysicsMover
/// </summary>
[DefaultExecutionOrder(-100)]
public class KinematicCharacterSystem : MonoBehaviour
{
private static KinematicCharacterSystem _instance;
public static List<KinematicCharacterMotor> CharacterMotors = new List<KinematicCharacterMotor>();
public static List<PhysicsMover> PhysicsMovers = new List<PhysicsMover>();
private static float _lastCustomInterpolationStartTime = -1f;
private static float _lastCustomInterpolationDeltaTime = -1f;
public static KCCSettings Settings;
/// <summary>
/// Creates a KinematicCharacterSystem instance if there isn't already one
/// </summary>
public static void EnsureCreation()
{
if (_instance == null)
{
GameObject systemGameObject = new GameObject("KinematicCharacterSystem");
_instance = systemGameObject.AddComponent<KinematicCharacterSystem>();
systemGameObject.hideFlags = HideFlags.NotEditable;
_instance.hideFlags = HideFlags.NotEditable;
Settings = ScriptableObject.CreateInstance<KCCSettings>();
GameObject.DontDestroyOnLoad(systemGameObject);
}
}
/// <summary>
/// Gets the KinematicCharacterSystem instance if any
/// </summary>
/// <returns></returns>
public static KinematicCharacterSystem GetInstance()
{
return _instance;
}
/// <summary>
/// Sets the maximum capacity of the character motors list, to prevent allocations when adding characters
/// </summary>
/// <param name="capacity"></param>
public static void SetCharacterMotorsCapacity(int capacity)
{
if (capacity < CharacterMotors.Count)
{
capacity = CharacterMotors.Count;
}
CharacterMotors.Capacity = capacity;
}
/// <summary>
/// Registers a KinematicCharacterMotor into the system
/// </summary>
public static void RegisterCharacterMotor(KinematicCharacterMotor motor)
{
CharacterMotors.Add(motor);
}
/// <summary>
/// Unregisters a KinematicCharacterMotor from the system
/// </summary>
public static void UnregisterCharacterMotor(KinematicCharacterMotor motor)
{
CharacterMotors.Remove(motor);
}
/// <summary>
/// Sets the maximum capacity of the physics movers list, to prevent allocations when adding movers
/// </summary>
/// <param name="capacity"></param>
public static void SetPhysicsMoversCapacity(int capacity)
{
if (capacity < PhysicsMovers.Count)
{
capacity = PhysicsMovers.Count;
}
PhysicsMovers.Capacity = capacity;
}
/// <summary>
/// Registers a PhysicsMover into the system
/// </summary>
public static void RegisterPhysicsMover(PhysicsMover mover)
{
PhysicsMovers.Add(mover);
mover.Rigidbody.interpolation = RigidbodyInterpolation.None;
}
/// <summary>
/// Unregisters a PhysicsMover from the system
/// </summary>
public static void UnregisterPhysicsMover(PhysicsMover mover)
{
PhysicsMovers.Remove(mover);
}
// This is to prevent duplicating the singleton gameobject on script recompiles
private void OnDisable()
{
Destroy(this.gameObject);
}
private void Awake()
{
_instance = this;
}
private void FixedUpdate()
{
if (Settings.AutoSimulation)
{
float deltaTime = Time.deltaTime;
if (Settings.Interpolate)
{
PreSimulationInterpolationUpdate(deltaTime);
}
Simulate(deltaTime, CharacterMotors, PhysicsMovers);
if (Settings.Interpolate)
{
PostSimulationInterpolationUpdate(deltaTime);
}
}
}
private void LateUpdate()
{
if (Settings.Interpolate)
{
CustomInterpolationUpdate();
}
}
/// <summary>
/// Remembers the point to interpolate from for KinematicCharacterMotors and PhysicsMovers
/// </summary>
public static void PreSimulationInterpolationUpdate(float deltaTime)
{
// Save pre-simulation poses and place transform at transient pose
for (int i = 0; i < CharacterMotors.Count; i++)
{
KinematicCharacterMotor motor = CharacterMotors[i];
motor.InitialTickPosition = motor.TransientPosition;
motor.InitialTickRotation = motor.TransientRotation;
motor.Transform.SetPositionAndRotation(motor.TransientPosition, motor.TransientRotation);
}
for (int i = 0; i < PhysicsMovers.Count; i++)
{
PhysicsMover mover = PhysicsMovers[i];
mover.InitialTickPosition = mover.TransientPosition;
mover.InitialTickRotation = mover.TransientRotation;
mover.Transform.SetPositionAndRotation(mover.TransientPosition, mover.TransientRotation);
mover.Rigidbody.position = mover.TransientPosition;
mover.Rigidbody.rotation = mover.TransientRotation;
}
}
/// <summary>
/// Ticks characters and/or movers
/// </summary>
public static void Simulate(float deltaTime, List<KinematicCharacterMotor> motors, List<PhysicsMover> movers)
{
int characterMotorsCount = motors.Count;
int physicsMoversCount = movers.Count;
#pragma warning disable 0162
// Update PhysicsMover velocities
for (int i = 0; i < physicsMoversCount; i++)
{
movers[i].VelocityUpdate(deltaTime);
}
// Character controller update phase 1
for (int i = 0; i < characterMotorsCount; i++)
{
motors[i].UpdatePhase1(deltaTime);
}
// Simulate PhysicsMover displacement
for (int i = 0; i < physicsMoversCount; i++)
{
PhysicsMover mover = movers[i];
mover.Transform.SetPositionAndRotation(mover.TransientPosition, mover.TransientRotation);
mover.Rigidbody.position = mover.TransientPosition;
mover.Rigidbody.rotation = mover.TransientRotation;
}
// Character controller update phase 2 and move
for (int i = 0; i < characterMotorsCount; i++)
{
KinematicCharacterMotor motor = motors[i];
motor.UpdatePhase2(deltaTime);
motor.Transform.SetPositionAndRotation(motor.TransientPosition, motor.TransientRotation);
}
#pragma warning restore 0162
}
/// <summary>
/// Initiates the interpolation for KinematicCharacterMotors and PhysicsMovers
/// </summary>
public static void PostSimulationInterpolationUpdate(float deltaTime)
{
_lastCustomInterpolationStartTime = Time.time;
_lastCustomInterpolationDeltaTime = deltaTime;
// Return interpolated roots to their initial poses
for (int i = 0; i < CharacterMotors.Count; i++)
{
KinematicCharacterMotor motor = CharacterMotors[i];
motor.Transform.SetPositionAndRotation(motor.InitialTickPosition, motor.InitialTickRotation);
}
for (int i = 0; i < PhysicsMovers.Count; i++)
{
PhysicsMover mover = PhysicsMovers[i];
if (mover.MoveWithPhysics)
{
mover.Rigidbody.position = mover.InitialTickPosition;
mover.Rigidbody.rotation = mover.InitialTickRotation;
mover.Rigidbody.MovePosition(mover.TransientPosition);
mover.Rigidbody.MoveRotation(mover.TransientRotation);
}
else
{
mover.Rigidbody.position = (mover.TransientPosition);
mover.Rigidbody.rotation = (mover.TransientRotation);
}
}
}
/// <summary>
/// Handles per-frame interpolation
/// </summary>
private static void CustomInterpolationUpdate()
{
float interpolationFactor = Mathf.Clamp01((Time.time - _lastCustomInterpolationStartTime) / _lastCustomInterpolationDeltaTime);
// Handle characters interpolation
for (int i = 0; i < CharacterMotors.Count; i++)
{
KinematicCharacterMotor motor = CharacterMotors[i];
motor.Transform.SetPositionAndRotation(
Vector3.Lerp(motor.InitialTickPosition, motor.TransientPosition, interpolationFactor),
Quaternion.Slerp(motor.InitialTickRotation, motor.TransientRotation, interpolationFactor));
}
// Handle PhysicsMovers interpolation
for (int i = 0; i < PhysicsMovers.Count; i++)
{
PhysicsMover mover = PhysicsMovers[i];
mover.Transform.SetPositionAndRotation(
Vector3.Lerp(mover.InitialTickPosition, mover.TransientPosition, interpolationFactor),
Quaternion.Slerp(mover.InitialTickRotation, mover.TransientRotation, interpolationFactor));
Vector3 newPos = mover.Transform.position;
Quaternion newRot = mover.Transform.rotation;
mover.PositionDeltaFromInterpolation = newPos - mover.LatestInterpolationPosition;
mover.RotationDeltaFromInterpolation = Quaternion.Inverse(mover.LatestInterpolationRotation) * newRot;
mover.LatestInterpolationPosition = newPos;
mover.LatestInterpolationRotation = newRot;
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: dbd80c9a62d41084aad50ae44255beb9
timeCreated: 1500241576
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/KinematicCharacterSystem.cs
uploadId: 505601

View File

@@ -0,0 +1,261 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace KinematicCharacterController
{
/// <summary>
/// Represents the entire state of a PhysicsMover that is pertinent for simulation.
/// Use this to save state or revert to past state
/// </summary>
[System.Serializable]
public struct PhysicsMoverState
{
public Vector3 Position;
public Quaternion Rotation;
public Vector3 Velocity;
public Vector3 AngularVelocity;
}
/// <summary>
/// Component that manages the movement of moving kinematic rigidbodies for
/// proper interaction with characters
/// </summary>
[RequireComponent(typeof(Rigidbody))]
public class PhysicsMover : MonoBehaviour
{
/// <summary>
/// The mover's Rigidbody
/// </summary>
[ReadOnly]
public Rigidbody Rigidbody;
/// <summary>
/// Determines if the platform moves with rigidbody.MovePosition (when true), or with rigidbody.position (when false)
/// </summary>
public bool MoveWithPhysics = true;
/// <summary>
/// Index of this motor in KinematicCharacterSystem arrays
/// </summary>
[NonSerialized]
public IMoverController MoverController;
/// <summary>
/// Remembers latest position in interpolation
/// </summary>
[NonSerialized]
public Vector3 LatestInterpolationPosition;
/// <summary>
/// Remembers latest rotation in interpolation
/// </summary>
[NonSerialized]
public Quaternion LatestInterpolationRotation;
/// <summary>
/// The latest movement made by interpolation
/// </summary>
[NonSerialized]
public Vector3 PositionDeltaFromInterpolation;
/// <summary>
/// The latest rotation made by interpolation
/// </summary>
[NonSerialized]
public Quaternion RotationDeltaFromInterpolation;
/// <summary>
/// Index of this motor in KinematicCharacterSystem arrays
/// </summary>
public int IndexInCharacterSystem { get; set; }
/// <summary>
/// Remembers initial position before all simulation are done
/// </summary>
public Vector3 Velocity { get; protected set; }
/// <summary>
/// Remembers initial position before all simulation are done
/// </summary>
public Vector3 AngularVelocity { get; protected set; }
/// <summary>
/// Remembers initial position before all simulation are done
/// </summary>
public Vector3 InitialTickPosition { get; set; }
/// <summary>
/// Remembers initial rotation before all simulation are done
/// </summary>
public Quaternion InitialTickRotation { get; set; }
/// <summary>
/// The mover's Transform
/// </summary>
public Transform Transform { get; private set; }
/// <summary>
/// The character's position before the movement calculations began
/// </summary>
public Vector3 InitialSimulationPosition { get; private set; }
/// <summary>
/// The character's rotation before the movement calculations began
/// </summary>
public Quaternion InitialSimulationRotation { get; private set; }
private Vector3 _internalTransientPosition;
/// <summary>
/// The mover's rotation (always up-to-date during the character update phase)
/// </summary>
public Vector3 TransientPosition
{
get
{
return _internalTransientPosition;
}
private set
{
_internalTransientPosition = value;
}
}
private Quaternion _internalTransientRotation;
/// <summary>
/// The mover's rotation (always up-to-date during the character update phase)
/// </summary>
public Quaternion TransientRotation
{
get
{
return _internalTransientRotation;
}
private set
{
_internalTransientRotation = value;
}
}
private void Reset()
{
ValidateData();
}
private void OnValidate()
{
ValidateData();
}
/// <summary>
/// Handle validating all required values
/// </summary>
public void ValidateData()
{
Rigidbody = gameObject.GetComponent<Rigidbody>();
Rigidbody.centerOfMass = Vector3.zero;
Rigidbody.maxAngularVelocity = Mathf.Infinity;
Rigidbody.maxDepenetrationVelocity = Mathf.Infinity;
Rigidbody.isKinematic = true;
Rigidbody.interpolation = RigidbodyInterpolation.None;
}
private void OnEnable()
{
KinematicCharacterSystem.EnsureCreation();
KinematicCharacterSystem.RegisterPhysicsMover(this);
}
private void OnDisable()
{
KinematicCharacterSystem.UnregisterPhysicsMover(this);
}
private void Awake()
{
Transform = this.transform;
ValidateData();
TransientPosition = Rigidbody.position;
TransientRotation = Rigidbody.rotation;
InitialSimulationPosition = Rigidbody.position;
InitialSimulationRotation = Rigidbody.rotation;
LatestInterpolationPosition = Transform.position;
LatestInterpolationRotation = Transform.rotation;
}
/// <summary>
/// Sets the mover's position directly
/// </summary>
public void SetPosition(Vector3 position)
{
Transform.position = position;
Rigidbody.position = position;
InitialSimulationPosition = position;
TransientPosition = position;
}
/// <summary>
/// Sets the mover's rotation directly
/// </summary>
public void SetRotation(Quaternion rotation)
{
Transform.rotation = rotation;
Rigidbody.rotation = rotation;
InitialSimulationRotation = rotation;
TransientRotation = rotation;
}
/// <summary>
/// Sets the mover's position and rotation directly
/// </summary>
public void SetPositionAndRotation(Vector3 position, Quaternion rotation)
{
Transform.SetPositionAndRotation(position, rotation);
Rigidbody.position = position;
Rigidbody.rotation = rotation;
InitialSimulationPosition = position;
InitialSimulationRotation = rotation;
TransientPosition = position;
TransientRotation = rotation;
}
/// <summary>
/// Returns all the state information of the mover that is pertinent for simulation
/// </summary>
public PhysicsMoverState GetState()
{
PhysicsMoverState state = new PhysicsMoverState();
state.Position = TransientPosition;
state.Rotation = TransientRotation;
state.Velocity = Velocity;
state.AngularVelocity = AngularVelocity;
return state;
}
/// <summary>
/// Applies a mover state instantly
/// </summary>
public void ApplyState(PhysicsMoverState state)
{
SetPositionAndRotation(state.Position, state.Rotation);
Velocity = state.Velocity;
AngularVelocity = state.AngularVelocity;
}
/// <summary>
/// Caches velocity values based on deltatime and target position/rotations
/// </summary>
public void VelocityUpdate(float deltaTime)
{
InitialSimulationPosition = TransientPosition;
InitialSimulationRotation = TransientRotation;
MoverController.UpdateMovement(out _internalTransientPosition, out _internalTransientRotation, deltaTime);
if (deltaTime > 0f)
{
Velocity = (TransientPosition - InitialSimulationPosition) / deltaTime;
Quaternion rotationFromCurrentToGoal = TransientRotation * (Quaternion.Inverse(InitialSimulationRotation));
AngularVelocity = (Mathf.Deg2Rad * rotationFromCurrentToGoal.eulerAngles) / deltaTime;
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 075ccbe9837b0744985e09ba3f015b9b
timeCreated: 1488089271
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/PhysicsMover.cs
uploadId: 505601

View File

@@ -0,0 +1,8 @@
using UnityEngine;
namespace KinematicCharacterController
{
public class ReadOnlyAttribute : PropertyAttribute
{
}
}

View File

@@ -0,0 +1,20 @@
fileFormatVersion: 2
guid: 63e8828991cf67f42bfeb498686aad0b
timeCreated: 1504493014
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Core/ReadOnlyAttribute.cs
uploadId: 505601

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: bf7d84d269b2ecf4db54490aa12a2044
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/UpgradeGuide.pdf
uploadId: 505601

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 218002b0df18c6f408925b74449e3784
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/UserGuide.pdf
uploadId: 505601

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 1523509a877e6cc41b0578ebaf09994b
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 99131
packageName: Kinematic Character Controller
packageVersion: 3.4.4
assetPath: Assets/KinematicCharacterController/Walkthrough.pdf
uploadId: 505601

View File

@@ -0,0 +1,59 @@
using UnityEngine;
namespace RealityReboot.jelycho.Player {
public class CameraSpring : MonoBehaviour {
[Min(0.01f), SerializeField] float m_HalfLife = 0.075f;
[SerializeField] float m_Frequency = 10.0f;
[SerializeField] float m_ForwardAngularDisplacement = 1.0f;
[SerializeField] float m_SidewaysAngularDisplacement = 1.0f;
[SerializeField] float m_HeightAngularDisplacement = 2.0f;
[SerializeField] float m_LinearDisplacement = 0.05f;
Vector3 m_SpringPosition;
Vector3 m_SpringVelocity;
public void Initialize() {
m_SpringPosition = transform.position;
m_SpringVelocity = Vector3.zero;
}
public void UpdateSpring(float deltaTime, Vector3 up, Vector3 right, Vector3 forward) {
Spring(ref m_SpringPosition,
ref m_SpringVelocity,
transform.position,
m_HalfLife,
m_Frequency,
deltaTime);
Vector3 localSpringPosition = m_SpringPosition - transform.position;
float springHeight = Vector3.Dot(localSpringPosition, up);
float springForward = Vector3.Dot(localSpringPosition, forward);
float springSideways = Vector3.Dot(localSpringPosition, right);
float pitch = -springHeight * m_HeightAngularDisplacement + -springForward * m_ForwardAngularDisplacement;
transform.localEulerAngles = new Vector3(pitch,
0.0f,
springSideways * m_SidewaysAngularDisplacement);
}
// Source: https://allenchou.net/2015/04/game-math-precise-control-over-numeric-springing/
static void Spring(ref Vector3 current,
ref Vector3 velocity,
Vector3 target,
float halfLife,
float frequency,
float timeStep) {
float dampingRatio = -Mathf.Log(0.5f) / (frequency * halfLife);
float f = 1.0f + 2.0f * timeStep * dampingRatio * frequency;
float oo = frequency * frequency;
float hoo = timeStep * oo;
float hhoo = timeStep * hoo;
float detInv = 1.0f / (f + hhoo);
Vector3 detX = f * current + timeStep * velocity + hhoo * target;
Vector3 detV = velocity + hoo * (target - current);
current = detX * detInv;
velocity = detV * detInv;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f3305bd258b340d69d9b813f76dc5a01
timeCreated: 1749115409

View File

@@ -0,0 +1,59 @@
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Simulation.Sensors;
using Unity.Cinemachine;
using UnityEngine;
namespace RealityReboot.jelycho.Player {
[AddComponentMenu(GameConsts.k_AddComponentMenu + "Player/First Person Camera")]
public class FPPCamera : MonoBehaviour {
[ConfigVar("fpp.camera.fov", 60.0f, "Field of view for the first person camera.")]
static ConfigVar s_cameraFOV;
[SerializeField] float _pickDistance = 5.0f;
[SerializeField] LayerMask _pickLayer;
[field: SerializeField]
public float Sensitivity { get; set; }
[SerializeField] float _pitchMin = -80f;
[SerializeField] float _pitchMax = 80f;
[field: SerializeField]
public CinemachineCamera Camera { get; private set; }
readonly RaycastSensor _raycastSensor = new();
public float Pitch { get; private set; }
public float Yaw { get; private set; }
public ISensor Sensor {
get {
_raycastSensor.ray = new Ray(Camera.transform.position, Camera.transform.forward);
_raycastSensor.maxDistance = _pickDistance;
_raycastSensor.layerMask = _pickLayer;
return _raycastSensor;
}
}
public void Tick() {
Camera.Lens.FieldOfView = s_cameraFOV.FloatValue;
Camera.transform.localRotation = Quaternion.Euler(Pitch, 0f, 0f);
}
public void Rotate(float x, float y) {
float sens = Sensitivity;
Pitch -= y * sens;
Pitch = Mathf.Clamp(Pitch, _pitchMin, _pitchMax);
Yaw += x * sens;
}
public void SetLookDirection(Vector3 forward) {
Pitch = Mathf.Asin(-forward.y) * Mathf.Rad2Deg;
Yaw = Mathf.Atan2(forward.x, forward.z) * Mathf.Rad2Deg;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: b82691de261d95842bde9bca81db0893

View File

@@ -1,7 +1,6 @@
using RebootKit.Engine.Extensions; using RebootKit.Engine.Extensions;
using RebootKit.Engine.Foundation; using RebootKit.Engine.Foundation;
using RebootKit.Engine.Services.Simulation; using RebootKit.Engine.Services.Simulation;
using RebootKit.FPPKit;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using Logger = RebootKit.Engine.Foundation.Logger; using Logger = RebootKit.Engine.Foundation.Logger;
@@ -9,22 +8,33 @@ using Logger = RebootKit.Engine.Foundation.Logger;
namespace RealityReboot.jelycho.Player { namespace RealityReboot.jelycho.Player {
public class PlayerActor : Actor { public class PlayerActor : Actor {
static readonly Logger s_logger = new(nameof(PlayerActor)); static readonly Logger s_logger = new(nameof(PlayerActor));
[SerializeField] PlayerFPPLocomotion m_Locomotion;
[SerializeField] FPPCamera m_Camera;
[SerializeField] Animator m_Animator;
[SerializeField] Transform m_DragGutStartPosition;
[SerializeField] Animator m_Animator;
[Header("Movement")]
[SerializeField] PlayerFPPLocomotion m_Locomotion;
[Header("Camera")]
[SerializeField] FPPCamera m_Camera;
[SerializeField] CameraSpring m_CameraSpring;
[Header("Dragging")]
[SerializeField] Transform m_DragGutStartPosition;
[SerializeField] PhysicsObjectDragger m_PhysicsDragger; [SerializeField] PhysicsObjectDragger m_PhysicsDragger;
[SerializeField] FloatRange m_DragDistanceRange = new(1.0f, 5.0f); [SerializeField] FloatRange m_DragDistanceRange = new(1.0f, 5.0f);
[SerializeField] LineRenderer m_LineRenderer; [SerializeField] LineRenderer m_LineRenderer;
public override void OnBeginPlay() {
m_CameraSpring.Initialize();
}
public override void OnTick() { public override void OnTick() {
m_Locomotion.YawRotation = m_Camera.Yaw;
m_Camera.Tick();
m_PhysicsDragger.TargetWorldPosition = m_Camera.Camera.transform.position + m_Camera.Camera.transform.forward * 2.0f; m_PhysicsDragger.TargetWorldPosition = m_Camera.Camera.transform.position + m_Camera.Camera.transform.forward * 2.0f;
if (m_PhysicsDragger.Current.OrNull() != null) { if (m_PhysicsDragger.Current.OrNull() is not null) {
m_LineRenderer.enabled = true; m_LineRenderer.enabled = true;
m_LineRenderer.SetPosition(0, m_LineRenderer.transform.InverseTransformPoint(m_DragGutStartPosition.position)); m_LineRenderer.SetPosition(0, m_LineRenderer.transform.InverseTransformPoint(m_DragGutStartPosition.position));
m_LineRenderer.SetPosition(1, m_LineRenderer.transform.InverseTransformPoint(m_PhysicsDragger.Current.position)); m_LineRenderer.SetPosition(1, m_LineRenderer.transform.InverseTransformPoint(m_PhysicsDragger.Current.position));
@@ -32,8 +42,17 @@ namespace RealityReboot.jelycho.Player {
m_LineRenderer.enabled = false; m_LineRenderer.enabled = false;
} }
Vector3 actorUp = transform.up;
Vector3 actorRight = transform.right;
Vector3 actorForward = transform.forward;
m_CameraSpring.UpdateSpring(Time.deltaTime, actorUp, actorRight, actorForward);
UpdateAnimator(); UpdateAnimator();
} }
public void SetSprint(bool isSprinting) {
m_Locomotion.SetSprint(isSprinting);
}
public void Jump() { public void Jump() {
m_Locomotion.Jump(); m_Locomotion.Jump();
@@ -44,7 +63,8 @@ namespace RealityReboot.jelycho.Player {
} }
public void SetMoveInput(Vector2 input) { public void SetMoveInput(Vector2 input) {
float3 direction = Quaternion.AngleAxis(m_Camera.Yaw, Vector3.up) * new float3(input.x, 0.0f, input.y); float3 direction = Quaternion.AngleAxis(transform.eulerAngles.y, Vector3.up) *
new float3(input.x, 0.0f, input.y);
m_Locomotion.SetWishDirection(direction); m_Locomotion.SetWishDirection(direction);
} }
@@ -66,12 +86,12 @@ namespace RealityReboot.jelycho.Player {
} }
void UpdateAnimator() { void UpdateAnimator() {
float forwardNormalized = m_Locomotion.LocalVelocity.z / m_Locomotion.runSpeed; // float forwardNormalized = m_Locomotion.LocalVelocity.z / m_Locomotion.runSpeed;
//
m_Animator.SetFloat(AnimatorParamHashes.s_VelocityForwardNormalized, forwardNormalized); // m_Animator.SetFloat(AnimatorParamHashes.s_VelocityForwardNormalized, forwardNormalized);
m_Animator.SetFloat(AnimatorParamHashes.s_VelocityRightNormalized, 0.0f); // m_Animator.SetFloat(AnimatorParamHashes.s_VelocityRightNormalized, 0.0f);
//
m_Animator.SetBool(AnimatorParamHashes.s_IsGrounded, m_Locomotion.IsGrounded); // m_Animator.SetBool(AnimatorParamHashes.s_IsGrounded, m_Locomotion.IsGrounded);
} }
} }
} }

View File

@@ -5,7 +5,7 @@ using RebootKit.Engine;
using RebootKit.Engine.Foundation; using RebootKit.Engine.Foundation;
using RebootKit.Engine.Main; using RebootKit.Engine.Main;
using RebootKit.Engine.Services.Input; using RebootKit.Engine.Services.Input;
using RebootKit.FPPKit; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;
using UnityEngine.InputSystem; using UnityEngine.InputSystem;
@@ -57,6 +57,8 @@ namespace RealityReboot.jelycho.Player {
Vector2 moveInput = m_Config.moveActionReference.action.ReadValue<Vector2>(); Vector2 moveInput = m_Config.moveActionReference.action.ReadValue<Vector2>();
m_FPPActor.SetMoveInput(moveInput); m_FPPActor.SetMoveInput(moveInput);
m_FPPActor.SetSprint(m_Config.sprintActionReference.action.IsPressed());
if (m_Config.jumpActionReference.action.WasPerformedThisFrame()) { if (m_Config.jumpActionReference.action.WasPerformedThisFrame()) {
m_FPPActor.Jump(); m_FPPActor.Jump();
} }
@@ -77,9 +79,40 @@ namespace RealityReboot.jelycho.Player {
public InputActionReference moveActionReference; public InputActionReference moveActionReference;
public InputActionReference lookActionReference; public InputActionReference lookActionReference;
public InputActionReference jumpActionReference; public InputActionReference jumpActionReference;
public InputActionReference sprintActionReference;
public InputActionReference dragObjectActionReference; public InputActionReference dragObjectActionReference;
public InputActionReference primaryActionReference; public InputActionReference primaryActionReference;
public InputActionReference secondaryActionReference; public InputActionReference secondaryActionReference;
} }
} }
public static class FPPConfig {
[ConfigVar("fpp.mouse.sens", 0.25f, "Mouse look sensitivity")] public static ConfigVar s_MouseSensitivity;
[ConfigVar("fpp.mouse.invert.y", 0, "Invert mouse look")] public static ConfigVar s_MouseInvertY;
[ConfigVar("fpp.gamepad.sens", 4.0f, "Gamepad look sensitivity")] public static ConfigVar s_GamepadSensitivity;
}
public static class SensitivityReader {
public static float2 Read(InputAction action) {
if (action == null || action.activeControl == null) {
return float2.zero;
}
float2 sensitivity = action.ReadValue<Vector2>();
bool isGamepad = action.activeControl.device is Gamepad;
if (isGamepad) {
sensitivity *= FPPConfig.s_GamepadSensitivity.FloatValue;
} else {
sensitivity *= FPPConfig.s_MouseSensitivity.FloatValue;
if (FPPConfig.s_MouseInvertY.IndexValue == 1) {
sensitivity.y *= -1;
}
}
return sensitivity;
}
}
} }

View File

@@ -1,17 +1,15 @@
using System; using System;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using RebootKit.Engine.Extensions; using KinematicCharacterController;
using Unity.Mathematics; using Unity.Mathematics;
using UnityEngine; using UnityEngine;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RealityReboot.jelycho.Player { namespace RealityReboot.jelycho.Player {
[RequireComponent(typeof(Rigidbody), typeof(CapsuleCollider))] public class PlayerFPPLocomotion : MonoBehaviour, ICharacterController {
public class PlayerFPPLocomotion : MonoBehaviour { static readonly Logger s_logger = new(nameof(PlayerFPPLocomotion));
static readonly RaycastHit[] s_HitBuffer = new RaycastHit[32];
[SerializeField] KinematicCharacterMotor m_Motor;
[SerializeField] Rigidbody m_Rigidbody;
[SerializeField] CapsuleCollider m_CapsuleCollider;
[SerializeField] LayerMask m_GroundLayerMask;
public float runSpeed = 10.0f; public float runSpeed = 10.0f;
public float sprintSpeed = 20.0f; public float sprintSpeed = 20.0f;
@@ -19,146 +17,170 @@ namespace RealityReboot.jelycho.Player {
public float groundAcceleration = 10.0f; public float groundAcceleration = 10.0f;
public float groundFriction = 10.0f; public float groundFriction = 10.0f;
public float airFriction = 1.0f;
public float jumpHeight = 2.0f; public float jumpHeight = 2.0f;
public float jumpInputDuration = 0.2f;
public float inAirAcceleration = 10.0f; public float coyoteDuration = 0.2f;
[Range(0.0f, 1.0f)] public float airControl = 0.5f;
public float gravity = 9.8f; public float gravity = 9.8f;
public float3 Velocity => m_Rigidbody.linearVelocity;
public float3 LocalVelocity => m_Rigidbody.transform.InverseTransformDirection(m_Rigidbody.linearVelocity);
float3 m_WishDir;
bool m_IsSprinting;
public bool IsGrounded { get; private set; } public float YawRotation { get; set; }
Vector3 m_WishDir;
bool m_IsSprinting;
bool m_IsJumpRequested;
float m_JumpRequestedTime;
float m_LastGroundedTime;
Vector3 m_LastVelocity;
public bool IsGrounded => m_Motor.GroundingStatus.IsStableOnGround;
void Awake() { void Awake() {
m_Motor.CharacterController = this;
} }
void FixedUpdate() { void OnDrawGizmos() {
IsGrounded = CheckGrounded();
float3 vel = m_Rigidbody.linearVelocity;
if (IsGrounded) {
UpdateGroundVelocity(ref vel, Time.fixedDeltaTime);
} else {
UpdateAirVelocity(ref vel, Time.fixedDeltaTime);
}
m_Rigidbody.linearVelocity = vel;
}
void ApplyGroundFriction(ref float3 vel, float dt) {
float speed = math.length(vel);
if (speed < 0.1f) {
vel = float3.zero;
return;
}
float drop = speed * groundFriction * dt;
float newSpeed = speed - drop;
if (newSpeed < 0.0f) {
newSpeed = 0.0f;
}
newSpeed /= speed;
vel *= newSpeed;
}
void ApplyGravity(ref float3 vel, float dt) {
vel.y -= gravity * dt;
}
void Accelerate(ref float3 vel, float3 wishDir, float wishSpeed, float acceleration, float dt) {
float currentSpeed = math.dot(vel, wishDir);
float addSpeed = wishSpeed - currentSpeed;
if (addSpeed <= 0.0f) {
return;
}
float accelSpeed = acceleration * dt * wishSpeed;
if (accelSpeed > addSpeed) {
accelSpeed = addSpeed;
}
vel += accelSpeed * wishDir;
}
void UpdateGroundVelocity(ref float3 vel, float dt) {
ApplyGroundFriction(ref vel, dt);
float wishSpeed;
if (m_IsSprinting) {
wishSpeed = sprintSpeed;
} else {
wishSpeed = runSpeed;
}
Accelerate(ref vel, m_WishDir, wishSpeed, groundAcceleration, dt);
ApplyGravity(ref vel, dt);
}
void UpdateAirVelocity(ref float3 vel, float dt) {
ApplyGravity(ref vel, dt);
Accelerate(ref vel, m_WishDir, runSpeed, inAirAcceleration, dt);
}
void OnValidate() {
if (m_Rigidbody == null) {
m_Rigidbody = GetComponent<Rigidbody>();
}
}
void OnDrawGizmosSelected() {
float3 origin = transform.position;
Gizmos.color = Color.blue; Gizmos.color = Color.blue;
Gizmos.DrawLine(origin, origin + m_WishDir); Gizmos.DrawLine(transform.position,
transform.position + m_WishDir * 2.0f);
Gizmos.color = Color.green;
Gizmos.DrawLine(origin, origin + Velocity);
} }
bool CheckGrounded() { void OnGUI() {
float3 origin = transform.position + Vector3.up * 0.1f; GUI.Label(new Rect(0, 0, Screen.width, Screen.height),
float3 direction = Vector3.down; $"Wish Direction: {m_WishDir}\n" +
float distance = 0.2f; $"Is Grounded: {m_Motor.GroundingStatus.IsStableOnGround}\n" +
$"Is Jump Requested: {m_IsJumpRequested}\n" +
int hitCount = Physics.SphereCastNonAlloc(origin, $"Motor Velocity: {m_Motor.Velocity}, magnitude: {m_Motor.Velocity.magnitude}\n" +
m_CapsuleCollider.radius, $"Motor Base Velocity: {m_Motor.BaseVelocity}, magnitude: {m_Motor.BaseVelocity.magnitude}\n" +
direction, $"Last Velocity: {m_LastVelocity}, magnitude: {math.length(m_LastVelocity)}\n");
s_HitBuffer,
distance,
m_GroundLayerMask,
QueryTriggerInteraction.Ignore);
for (int i = 0; i < hitCount; i++) {
RaycastHit hit = s_HitBuffer[i];
if (hit.collider is not null && hit.collider.gameObject != gameObject) {
return true;
}
}
return false;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetWishDirection(float3 dir) { public void SetWishDirection(Vector3 dir) {
m_WishDir = dir; m_WishDir = dir;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Jump() { public void Jump() {
if (IsGrounded) { m_IsJumpRequested = true;
m_Rigidbody.AddForce(Vector3.up * CalculateJumpVelocity(jumpHeight, gravity), ForceMode.VelocityChange); m_JumpRequestedTime = Time.time;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public void SetSprint(bool isSprinting) {
m_IsSprinting = isSprinting;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
static float CalculateJumpVelocity(float jumpHeight, float gravity) { static float CalculateJumpVelocity(float jumpHeight, float gravity) {
return math.sqrt(2.0f * gravity * jumpHeight); return math.sqrt(2.0f * gravity * jumpHeight);
} }
public void UpdateRotation(ref Quaternion currentRotation, float deltaTime) {
currentRotation = Quaternion.AngleAxis(YawRotation, Vector3.up);
}
void Accelerate(ref Vector3 currentVelocity,
float wishSpeed,
float control,
float deltaTime) {
float currentSpeed = Vector3.Dot(currentVelocity, m_WishDir);
float addSpeed = wishSpeed - currentSpeed;
if (addSpeed <= 0.0f) {
return;
}
float accelSpeed = groundAcceleration * deltaTime * wishSpeed;
if (accelSpeed > addSpeed) {
accelSpeed = addSpeed;
}
currentVelocity += accelSpeed * control * m_WishDir;
}
void ApplyFriction(ref Vector3 currentVelocity, float friction, float deltaTime) {
float speed = currentVelocity.magnitude;
if (speed <= 0.0f) {
return;
}
float drop = speed * friction * deltaTime;
if (drop < speed) {
currentVelocity *= (speed - drop) / speed;
} else {
currentVelocity = Vector3.zero;
}
}
void GroundMovement(ref Vector3 currentVelocity, float deltaTime) {
float wishSpeed = m_IsSprinting ? sprintSpeed : runSpeed;
Accelerate(ref currentVelocity, wishSpeed, 1.0f, deltaTime);
ApplyFriction(ref currentVelocity, groundFriction, deltaTime);
}
void ApplyGravity(ref Vector3 currentVelocity, float deltaTime) {
currentVelocity.y -= gravity * deltaTime;
}
public void UpdateVelocity(ref Vector3 currentVelocity, float deltaTime) {
if (Time.time > m_JumpRequestedTime + jumpInputDuration) {
m_IsJumpRequested = false;
}
if (m_Motor.GroundingStatus.IsStableOnGround) {
m_LastGroundedTime = Time.time;
}
bool canJump = m_Motor.GroundingStatus.IsStableOnGround ||
Time.time < m_LastGroundedTime + coyoteDuration;
if (m_IsJumpRequested && canJump) {
currentVelocity.y = CalculateJumpVelocity(jumpHeight, gravity);
m_Motor.ForceUnground();
m_IsJumpRequested = false;
m_LastGroundedTime = 0.0f;
}
if (m_Motor.GroundingStatus.IsStableOnGround) {
GroundMovement(ref currentVelocity, deltaTime);
} else {
Accelerate(ref currentVelocity, runSpeed, airControl, deltaTime);
ApplyFriction(ref currentVelocity, airFriction, deltaTime);
ApplyGravity(ref currentVelocity, deltaTime);
}
m_LastVelocity = currentVelocity;
}
public void BeforeCharacterUpdate(float deltaTime) {
}
public void PostGroundingUpdate(float deltaTime) {
}
public void AfterCharacterUpdate(float deltaTime) {
}
public bool IsColliderValidForCollisions(Collider coll) {
return true;
}
public void OnGroundHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport) {
}
public void OnMovementHit(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, ref HitStabilityReport hitStabilityReport) {
}
public void ProcessHitStabilityReport(Collider hitCollider, Vector3 hitNormal, Vector3 hitPoint, Vector3 atCharacterPosition, Quaternion atCharacterRotation, ref HitStabilityReport hitStabilityReport) {
}
public void OnDiscreteCollisionDetected(Collider hitCollider) {
}
} }
} }

View File

@@ -22,6 +22,7 @@ MonoBehaviour:
moveActionReference: {fileID: -2772844096359753972, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3} moveActionReference: {fileID: -2772844096359753972, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
lookActionReference: {fileID: -5630151704836100654, guid: 052faaac586de48259a63d0c4782560b, type: 3} lookActionReference: {fileID: -5630151704836100654, guid: 052faaac586de48259a63d0c4782560b, type: 3}
jumpActionReference: {fileID: -2099379676528639254, guid: 052faaac586de48259a63d0c4782560b, type: 3} jumpActionReference: {fileID: -2099379676528639254, guid: 052faaac586de48259a63d0c4782560b, type: 3}
sprintActionReference: {fileID: 7801716088028601855, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
dragObjectActionReference: {fileID: 2331847964233633448, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3} dragObjectActionReference: {fileID: 2331847964233633448, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
primaryActionReference: {fileID: 7005240712943983493, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3} primaryActionReference: {fileID: 7005240712943983493, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}
secondaryActionReference: {fileID: -1076036341132388265, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3} secondaryActionReference: {fileID: -1076036341132388265, guid: f991e9abd9a53ee4b94b329a5ce96cb2, type: 3}

View File

@@ -139,6 +139,57 @@ LineRenderer:
m_UseWorldSpace: 0 m_UseWorldSpace: 0
m_Loop: 0 m_Loop: 0
m_ApplyActiveColorSpace: 1 m_ApplyActiveColorSpace: 1
--- !u!1 &2647022434574196008
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 9181414832138245197}
- component: {fileID: 2863764702303138330}
m_Layer: 0
m_Name: cam_spring
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &9181414832138245197
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2647022434574196008}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3547307509376589031}
m_Father: {fileID: 7761779135599839476}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2863764702303138330
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2647022434574196008}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f3305bd258b340d69d9b813f76dc5a01, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HalfLife: 0.075
m_Frequency: 12
m_ForwardAngularDisplacement: 3
m_SidewaysAngularDisplacement: 2
m_HeightAngularDisplacement: 4
m_LinearDisplacement: 0.1
--- !u!1 &6086846679135428685 --- !u!1 &6086846679135428685
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -154,6 +205,7 @@ GameObject:
- component: {fileID: 3351589437949293952} - component: {fileID: 3351589437949293952}
- component: {fileID: 3055557605397218987} - component: {fileID: 3055557605397218987}
- component: {fileID: 447378847805683535} - component: {fileID: 447378847805683535}
- component: {fileID: 7994225944200444124}
m_Layer: 0 m_Layer: 0
m_Name: a_player m_Name: a_player
m_TagString: Untagged m_TagString: Untagged
@@ -174,7 +226,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 3547307509376589031} - {fileID: 9181414832138245197}
- {fileID: 8215559081039065670} - {fileID: 8215559081039065670}
- {fileID: 94470064633413912} - {fileID: 94470064633413912}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@@ -196,9 +248,10 @@ MonoBehaviour:
B: 1139302270 B: 1139302270
C: 1967136438 C: 1967136438
D: 3433895425 D: 3433895425
m_Animator: {fileID: 2658156910203414588}
m_Locomotion: {fileID: 3055557605397218987} m_Locomotion: {fileID: 3055557605397218987}
m_Camera: {fileID: 7282522638044830840} m_Camera: {fileID: 7282522638044830840}
m_Animator: {fileID: 2658156910203414588} m_CameraSpring: {fileID: 2863764702303138330}
m_DragGutStartPosition: {fileID: 0} m_DragGutStartPosition: {fileID: 0}
m_PhysicsDragger: {fileID: 2402344678768307677} m_PhysicsDragger: {fileID: 2402344678768307677}
m_DragDistanceRange: m_DragDistanceRange:
@@ -280,21 +333,20 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: ee4e0741b71b4e0e81f8109748ea961d, type: 3} m_Script: {fileID: 11500000, guid: ee4e0741b71b4e0e81f8109748ea961d, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_Rigidbody: {fileID: 3351589437949293952} m_Motor: {fileID: 7994225944200444124}
m_CapsuleCollider: {fileID: 447378847805683535}
m_GroundLayerMask:
serializedVersion: 2
m_Bits: 1
runSpeed: 10 runSpeed: 10
sprintSpeed: 20 sprintSpeed: 20
groundAcceleration: 8 groundAcceleration: 8
groundFriction: 7 groundFriction: 9.91
jumpHeight: 3 airFriction: 1.5
inAirAcceleration: 1 jumpHeight: 2
gravity: 9.8 jumpInputDuration: 0.2
coyoteDuration: 0.2
airControl: 0.15
gravity: 25
--- !u!136 &447378847805683535 --- !u!136 &447378847805683535
CapsuleCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 8
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
@@ -311,10 +363,52 @@ CapsuleCollider:
m_ProvidesContacts: 0 m_ProvidesContacts: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2 serializedVersion: 2
m_Radius: 0.25 m_Radius: 0.5
m_Height: 1.8 m_Height: 2
m_Direction: 1 m_Direction: 1
m_Center: {x: 0, y: 0.9, z: 0} m_Center: {x: 0, y: 1, z: 0}
--- !u!114 &7994225944200444124
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6086846679135428685}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4d1bc5515e3ab954e80599c538834774, type: 3}
m_Name:
m_EditorClassIdentifier:
Capsule: {fileID: 447378847805683535}
CapsuleRadius: 0.5
CapsuleHeight: 2
CapsuleYOffset: 1
CapsulePhysicsMaterial: {fileID: 0}
GroundDetectionExtraDistance: 0
MaxStableSlopeAngle: 60
StableGroundLayers:
serializedVersion: 2
m_Bits: 4294967295
DiscreteCollisionEvents: 0
StepHandling: 1
MaxStepHeight: 0.5
AllowSteppingWithoutStableGrounding: 0
MinRequiredStepDepth: 0.1
LedgeAndDenivelationHandling: 1
MaxStableDistanceFromLedge: 0.5
MaxVelocityForLedgeSnap: 0
MaxStableDenivelationAngle: 180
InteractiveRigidbodyHandling: 1
RigidbodyInteractionType: 0
SimulatedCharacterMass: 1
PreserveAttachedRigidbodyMomentum: 1
HasPlanarConstraint: 0
PlanarConstraintAxis: {x: 0, y: 0, z: 1}
MaxMovementIterations: 5
MaxDecollisionIterations: 1
CheckMovementInitialOverlaps: 1
KillVelocityWhenExceedMaxMovementIterations: 1
KillRemainingMovementWhenExceedMaxMovementIterations: 1
--- !u!1 &7887986861182861129 --- !u!1 &7887986861182861129
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -325,9 +419,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 3547307509376589031} - component: {fileID: 3547307509376589031}
- component: {fileID: 8557190970217331903} - component: {fileID: 8557190970217331903}
- component: {fileID: 3227912592152092828}
m_Layer: 0 m_Layer: 0
m_Name: FPP Camera m_Name: cc_fpp
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@@ -346,7 +439,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 7761779135599839476} m_Father: {fileID: 9181414832138245197}
m_LocalEulerAnglesHint: {x: 29.409, y: 180, z: 0} m_LocalEulerAnglesHint: {x: 29.409, y: 180, z: 0}
--- !u!114 &8557190970217331903 --- !u!114 &8557190970217331903
MonoBehaviour: MonoBehaviour:
@@ -391,21 +484,6 @@ MonoBehaviour:
BarrelClipping: 0.25 BarrelClipping: 0.25
Anamorphism: 0 Anamorphism: 0
BlendHint: 0 BlendHint: 0
--- !u!114 &3227912592152092828
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7887986861182861129}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 43e47286597d44b9bca21389d3909958, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Components: 1
m_Source: {fileID: 0}
m_UpdateLoop: 2
--- !u!1001 &8469368785544680877 --- !u!1001 &8469368785544680877
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@@ -454,6 +532,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -4571605982943762130, guid: 31a170ffc0fb03b4ca61567fae38e28f, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: -4571605982943762130, guid: 31a170ffc0fb03b4ca61567fae38e28f, type: 3} - target: {fileID: -4571605982943762130, guid: 31a170ffc0fb03b4ca61567fae38e28f, type: 3}
propertyPath: 'm_Materials.Array.data[0]' propertyPath: 'm_Materials.Array.data[0]'
value: value:
@@ -844,7 +926,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: fff0960ef4ea6e04eac66b4a7fd2189d, type: 3} m_Script: {fileID: 11500000, guid: fff0960ef4ea6e04eac66b4a7fd2189d, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
m_RigLayers: [] m_RigLayers:
- m_Rig: {fileID: 0}
m_Active: 1
m_Effectors: [] m_Effectors: []
--- !u!114 &1484787928313346834 --- !u!114 &1484787928313346834
MonoBehaviour: MonoBehaviour: