diff --git a/Assets/prefabs/Player.prefab b/Assets/prefabs/Player.prefab index 0a00287..ff1ccf6 100644 --- a/Assets/prefabs/Player.prefab +++ b/Assets/prefabs/Player.prefab @@ -108,7 +108,7 @@ "_type": "gameobject", "go": "0802fa96-3b6e-49e1-a830-a4f57e1b0e2a" }, - "CamOffsetX": 72, + "CamOffset": "-14.5,-75.5,10.9", "CurrentClothing": { "DisplayName": null, "Height": 0.5, @@ -117,6 +117,10 @@ "PrefersHuman": false }, "DuckSpeed": 100, + "Eyes": { + "_type": "gameobject", + "go": "105781d8-aa77-4d82-bd84-4068b0e54199" + }, "InteractDistance": 350, "Inventory": null, "InventoryUI": { @@ -1999,8 +2003,8 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_01", - "Position": "5.870217,0.005632026,11.81102", - "Rotation": "-0.0001436457,-0.01695743,-0.008462192,0.9998204", + "Position": "5.872967,0.006041013,11.81102", + "Rotation": "-0.0001633297,-0.01784967,-0.009139647,0.9997989", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2016,7 +2020,7 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_02a", - "Position": "5.870218,0.005633741,9.842515", + "Position": "5.872967,0.006041013,9.842515", "Rotation": "-0.00000000000000000000001185265,0.0000000000000001455021,-0.0000003871369,1", "Scale": "1,1,1", "Tags": "", @@ -2033,7 +2037,7 @@ "__version": 1, "Flags": 8, "Name": "aim_matrix_02b", - "Position": "9.80722,0.005630211,9.842513", + "Position": "9.809968,0.006037482,9.842513", "Rotation": "-0.00000000000000000000001185278,0.0000000000000001455018,-0.0000003871369,1", "Scale": "1,1,1", "Tags": "", @@ -2050,8 +2054,8 @@ "__version": 1, "Flags": 8, "Name": "ankle_R", - "Position": "0.410028,-4.377077,3.807501", - "Rotation": "0.672856,0.2185198,-0.3316688,0.6241072", + "Position": "0.4100297,-4.377069,3.807491", + "Rotation": "0.6728561,0.2185199,-0.3316684,0.6241072", "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, @@ -2067,9 +2071,9 @@ "__version": 1, "Flags": 8, "Name": "ankle_L", - "Position": "0.4083693,4.427526,3.805846", - "Rotation": "0.6245864,0.3321082,-0.2183172,0.6722601", - "Scale": "1.000002,1.000002,1.000002", + "Position": "0.4083853,4.427594,3.805824", + "Rotation": "0.6245877,0.3321062,-0.2183191,0.6722592", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2084,8 +2088,8 @@ "__version": 1, "Flags": 8, "Name": "arm_lower_R", - "Position": "-2.194259,-8.597884,41.03161", - "Rotation": "0.4999644,0.3842734,-0.5448902,0.5526884", + "Position": "-2.415514,-8.693256,40.92277", + "Rotation": "0.5050567,0.374271,-0.5378657,0.561729", "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, @@ -2101,9 +2105,9 @@ "__version": 1, "Flags": 8, "Name": "arm_lower_L", - "Position": "-1.81736,9.811557,41.48081", - "Rotation": "0.5791489,0.5418196,-0.3768404,0.4785494", - "Scale": "1.000003,1.000003,1.000003", + "Position": "-2.065563,9.910057,41.4312", + "Rotation": "0.5884632,0.5365309,-0.3654193,0.4819899", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2118,8 +2122,8 @@ "__version": 1, "Flags": 8, "Name": "hand_R", - "Position": "-1.339935,-10.27848,33.559", - "Rotation": "0.4707156,0.3625441,-0.6014581,0.5340759", + "Position": "-1.327014,-10.43666,33.49512", + "Rotation": "0.4767994,0.3525229,-0.5948111,0.5427613", "Scale": "1.000003,1.000003,1.000003", "Tags": "", "Enabled": true, @@ -2135,9 +2139,9 @@ "__version": 1, "Flags": 8, "Name": "hand_L", - "Position": "-0.8243989,11.86851,34.12033", - "Rotation": "0.5608078,0.5982507,-0.3530176,0.4505211", - "Scale": "1.000004,1.000004,1.000004", + "Position": "-0.8540348,12.0617,34.13079", + "Rotation": "0.5696679,0.593228,-0.3414524,0.4549389", + "Scale": "1.000003,1.000003,1.000003", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2152,9 +2156,9 @@ "__version": 1, "Flags": 8, "Name": "hold_R", - "Position": "-0.04774434,-8.809499,27.49088", - "Rotation": "0.3177992,0.7286226,0.06634814,0.6030844", - "Scale": "1.000003,1.000003,1.000003", + "Position": "0.1449476,-9.016528,27.4564", + "Rotation": "0.3127081,0.7201924,0.06906751,0.61544", + "Scale": "1.000004,1.000004,1.000004", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2169,9 +2173,9 @@ "__version": 1, "Flags": 8, "Name": "hold_L", - "Position": "0.4636755,10.68709,27.98863", - "Rotation": "-0.2854522,0.7340876,-0.05970929,0.6132432", - "Scale": "1.000004,1.000004,1.000004", + "Position": "0.6086711,10.95811,28.02384", + "Rotation": "-0.2794754,0.7258716,-0.0597837,0.6256435", + "Scale": "1.000003,1.000003,1.000003", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2186,8 +2190,8 @@ "__version": 1, "Flags": 8, "Name": "IK_right_hand", - "Position": "-1.69492,-11.30738,33.23634", - "Rotation": "0.4603694,0.3490216,-0.6097843,0.5425929", + "Position": "-1.70549,-11.30311,33.23475", + "Rotation": "0.4605321,0.3488436,-0.6099709,0.5423597", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2203,8 +2207,8 @@ "__version": 1, "Flags": 8, "Name": "IK_left_hand", - "Position": "-1.506716,11.36749,33.23344", - "Rotation": "0.5483295,0.6047426,-0.3533798,0.4568848", + "Position": "-1.502214,11.36806,33.23162", + "Rotation": "0.5485557,0.6045254,-0.3535507,0.4567688", "Scale": "1,1,1", "Tags": "", "Enabled": true, @@ -2220,9 +2224,9 @@ "__version": 1, "Flags": 8, "Name": "leg_lower_R", - "Position": "2.184814,-4.448565,16.19641", - "Rotation": "0.4909281,0.5035037,-0.5633716,0.4336888", - "Scale": "1.000001,1.000001,1.000001", + "Position": "2.140212,-4.426102,16.20282", + "Rotation": "0.4912729,0.5025679,-0.5626246,0.4353504", + "Scale": "1,1,1", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2237,9 +2241,9 @@ "__version": 1, "Flags": 8, "Name": "leg_lower_L", - "Position": "3.076369,4.83484,16.02696", - "Rotation": "0.4118131,0.5700959,-0.5306391,0.4730991", - "Scale": "1.000002,1.000002,1.000002", + "Position": "2.944108,4.841949,16.05482", + "Rotation": "0.4142257,0.5677253,-0.5281958,0.476565", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2254,8 +2258,8 @@ "__version": 1, "Flags": 8, "Name": "middle_of_both_hands", - "Position": "-0.9578716,0.9275346,29.00694", - "Rotation": "0.0188594,0.7564194,0.003402324,0.6538061", + "Position": "-0.8171214,0.9550338,29.00532", + "Rotation": "0.01974888,0.7515687,0.004535146,0.6593435", "Scale": "1.000003,1.000003,1.000003", "Tags": "", "Enabled": true, @@ -2271,7 +2275,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_upper_R_twist1", - "Position": "-1.254098,-7.691903,45.88158", + "Position": "-1.529419,-7.756166,45.777", "Rotation": "0,0,0,1", "Scale": "1.000002,1.000002,1.000002", "Tags": "", @@ -2288,7 +2292,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_lower_R_twist1", - "Position": "-1.767097,-9.438183,37.29531", + "Position": "-1.871264,-9.56496,37.20895", "Rotation": "0,0,0,1", "Scale": "1.000003,1.000003,1.000003", "Tags": "", @@ -2305,9 +2309,9 @@ "__version": 1, "Flags": 8, "Name": "driver_elbow_R_position", - "Position": "-2.190993,-8.60187,41.02747", - "Rotation": "-0.02503278,-0.6311682,0.7749069,0.02278909", - "Scale": "1.000003,1.000003,1.000003", + "Position": "-2.431499,-8.694861,40.91875", + "Rotation": "-0.03318984,-0.6286435,0.776837,0.01517099", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2322,9 +2326,9 @@ "__version": 1, "Flags": 8, "Name": "driver_elbow_L_position", - "Position": "-1.813897,9.815627,41.47688", - "Rotation": "-0.04689195,0.7901233,-0.6070659,0.07055109", - "Scale": "1.000003,1.000003,1.000003", + "Position": "-2.081447,9.912534,41.42717", + "Rotation": "-0.04039298,0.7933497,-0.60225,0.0791183", + "Scale": "1.000002,1.000002,1.000002", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2339,7 +2343,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_upper_L_twist1", - "Position": "-0.9609264,8.598832,46.279", + "Position": "-1.253342,8.643686,46.22322", "Rotation": "0,0,0,1", "Scale": "1.000002,1.000002,1.000002", "Tags": "", @@ -2356,7 +2360,7 @@ "__version": 1, "Flags": 8, "Name": "driver_arm_lower_L_twist1", - "Position": "-1.320879,10.84003,37.80057", + "Position": "-1.459799,10.98588,37.78099", "Rotation": "0,0,0,1", "Scale": "1.000003,1.000003,1.000003", "Tags": "", @@ -2373,9 +2377,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_upper_R_twist1", - "Position": "1.417546,-4.285876,23.38899", + "Position": "1.379063,-4.254407,23.39583", "Rotation": "0,0,0,1", - "Scale": "1.000001,1.000001,1.000001", + "Scale": "1,1,1", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2390,9 +2394,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_upper_L_twist1", - "Position": "1.893557,4.78091,23.1646", + "Position": "1.812529,4.80524,23.20087", "Rotation": "0,0,0,1", - "Scale": "1.000001,1.000001,1.000001", + "Scale": "1,1,1", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2407,9 +2411,9 @@ "__version": 1, "Flags": 8, "Name": "driver_kneecap_R_position", - "Position": "2.55332,-4.490733,16.16589", - "Rotation": "0.5185107,0.4741844,-0.5331934,0.4711695", - "Scale": "1.000001,1.000001,1.000001", + "Position": "2.502184,-4.467493,16.17297", + "Rotation": "0.5185029,0.4735409,-0.5331084,0.4719208", + "Scale": "1,1,1", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2424,9 +2428,9 @@ "__version": 1, "Flags": 8, "Name": "driver_kneecap_L_position", - "Position": "3.636433,4.894081,15.98802", - "Rotation": "0.7003412,0.04433943,0.02620117,0.7119479", - "Scale": "1.000001,1.000001,1.000001", + "Position": "3.477942,4.898448,16.01743", + "Rotation": "0.6999867,0.04382173,0.02689065,0.7123027", + "Scale": "1,1,1", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2441,9 +2445,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_lower_R_twist1", - "Position": "1.297414,-4.412823,10.00197", + "Position": "1.275122,-4.401587,10.00517", "Rotation": "0,0,0,1", - "Scale": "1.000002,1.000002,1.000002", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2458,9 +2462,9 @@ "__version": 1, "Flags": 8, "Name": "driver_leg_lower_L_twist1", - "Position": "1.742369,4.631183,9.916401", + "Position": "1.676247,4.634771,9.930321", "Rotation": "0,0,0,1", - "Scale": "1.000002,1.000002,1.000002", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2475,7 +2479,7 @@ "__version": 1, "Flags": 8, "Name": "forward_reference_modelspace", - "Position": "-0.1452158,0.252435,43.40723", + "Position": "-0.3715452,0.2550741,43.42545", "Rotation": "0,0,0,1", "Scale": "1.000001,1.000001,1.000001", "Tags": "", @@ -2492,9 +2496,9 @@ "__version": 1, "Flags": 8, "Name": "eyes", - "Position": "6.100418,-0.1673432,63.23436", - "Rotation": "0.01170801,-0.0143232,-0.01524511,0.9997126", - "Scale": "1.000002,1.000002,1.000002", + "Position": "5.598311,-0.2268828,63.32236", + "Rotation": "0.01307973,-0.020068,-0.01569684,0.9995899", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2509,9 +2513,9 @@ "__version": 1, "Flags": 8, "Name": "eye_R_forward", - "Position": "5.999535,-3.511322,63.15456", - "Rotation": "0.01170801,-0.0143232,-0.01524511,0.9997126", - "Scale": "1.000002,1.000002,1.000002", + "Position": "5.495053,-3.57054,63.23274", + "Rotation": "0.01307973,-0.020068,-0.01569684,0.9995899", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2526,9 +2530,9 @@ "__version": 1, "Flags": 8, "Name": "eye_L_forward", - "Position": "6.201299,3.176636,63.31416", - "Rotation": "0.01170801,-0.0143232,-0.01524511,0.9997126", - "Scale": "1.000002,1.000002,1.000002", + "Position": "5.701567,3.116774,63.41198", + "Rotation": "0.01307973,-0.020068,-0.01569684,0.9995899", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2543,9 +2547,9 @@ "__version": 1, "Flags": 8, "Name": "forward_reference", - "Position": "0.989872,0.1547238,56.19901", - "Rotation": "0.01170801,-0.0143232,-0.01524511,0.9997126", - "Scale": "1.000002,1.000002,1.000002", + "Position": "0.5694897,0.1185142,56.22946", + "Rotation": "0.01307973,-0.020068,-0.01569684,0.9995899", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2560,9 +2564,9 @@ "__version": 1, "Flags": 8, "Name": "foot_R", - "Position": "1.982141,-4.910424,0.1893171", - "Rotation": "0.0004869699,-0.00001408905,-0.08711599,0.9961981", - "Scale": "1.000002,1.000002,1.000002", + "Position": "1.982148,-4.91043,0.1893211", + "Rotation": "0.0004870296,-0.00001396612,-0.08711576,0.9961981", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2577,9 +2581,9 @@ "__version": 1, "Flags": 8, "Name": "foot_L", - "Position": "1.978678,4.966802,1.053338", - "Rotation": "-0.08723825,0.9961874,0.0004065633,0.00001362779", - "Scale": "1.000002,1.000002,1.000002", + "Position": "1.978698,4.96686,1.053328", + "Rotation": "-0.08723518,0.9961877,0.0004069209,0.00001392581", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2594,9 +2598,9 @@ "__version": 1, "Flags": 8, "Name": "hat", - "Position": "0.8454286,-0.2021334,71.35446", - "Rotation": "0.01170801,-0.0143232,-0.01524511,0.9997126", - "Scale": "1.000002,1.000002,1.000002", + "Position": "0.2500786,-0.2772586,71.38126", + "Rotation": "0.01307973,-0.020068,-0.01569684,0.9995899", + "Scale": "1.000001,1.000001,1.000001", "Tags": "", "Enabled": true, "NetworkMode": 2, @@ -2611,68 +2615,7 @@ "__version": 1, "Flags": 0, "Name": "Pivot", - "Position": "1.812938,-15.65946,51.27624", - "Rotation": "0.003578067,0.06026466,-0.01210088,0.9981027", - "Scale": "1,1,1", - "Tags": "", - "Enabled": true, - "NetworkMode": 2, - "NetworkInterpolation": true, - "NetworkOrphaned": 0, - "OwnerTransfer": 1, - "Components": [], - "Children": [] - } - ] - }, - { - "__guid": "98233a1a-fddc-4c4e-8740-4325dbb453c8", - "__version": 1, - "Flags": 0, - "Name": "Camera", - "Position": "-70,-20,60", - "Rotation": "0,0,0,1", - "Scale": "1,1,1", - "Tags": "", - "Enabled": true, - "NetworkMode": 2, - "NetworkInterpolation": true, - "NetworkOrphaned": 0, - "OwnerTransfer": 1, - "Components": [ - { - "__type": "Sandbox.CameraComponent", - "__guid": "e753147c-80f4-4cc0-8e7b-83612ea05560", - "__enabled": true, - "BackgroundColor": "0.33333,0.46275,0.52157,1", - "ClearFlags": "All", - "FieldOfView": 100, - "FovAxis": "Horizontal", - "IsMainCamera": true, - "OnComponentDestroy": null, - "OnComponentDisabled": null, - "OnComponentEnabled": null, - "OnComponentFixedUpdate": null, - "OnComponentStart": null, - "OnComponentUpdate": null, - "Orthographic": false, - "OrthographicHeight": 1204, - "Priority": 1, - "RenderExcludeTags": "", - "RenderTags": "", - "TargetEye": "None", - "Viewport": "0,0,1,1", - "ZFar": 32768, - "ZNear": 10 - } - ], - "Children": [ - { - "__guid": "c51bcc79-401c-446e-ad03-8bc8df117858", - "__version": 1, - "Flags": 0, - "Name": "LookAt", - "Position": "200,0,0", + "Position": "2.852271,-15.34881,50.88791", "Rotation": "0,0,0,1", "Scale": "1,1,1", "Tags": "", @@ -2682,7 +2625,69 @@ "NetworkOrphaned": 0, "OwnerTransfer": 1, "Components": [], - "Children": [] + "Children": [ + { + "__guid": "98233a1a-fddc-4c4e-8740-4325dbb453c8", + "__version": 1, + "Flags": 0, + "Name": "Camera", + "Position": "-72.85227,-4.651191,9.112095", + "Rotation": "0,0,0,1", + "Scale": "1,1,1", + "Tags": "", + "Enabled": true, + "NetworkMode": 2, + "NetworkInterpolation": true, + "NetworkOrphaned": 0, + "OwnerTransfer": 1, + "Components": [ + { + "__type": "Sandbox.CameraComponent", + "__guid": "e753147c-80f4-4cc0-8e7b-83612ea05560", + "__enabled": true, + "BackgroundColor": "0.33333,0.46275,0.52157,1", + "ClearFlags": "All", + "FieldOfView": 100, + "FovAxis": "Horizontal", + "IsMainCamera": true, + "OnComponentDestroy": null, + "OnComponentDisabled": null, + "OnComponentEnabled": null, + "OnComponentFixedUpdate": null, + "OnComponentStart": null, + "OnComponentUpdate": null, + "Orthographic": false, + "OrthographicHeight": 1204, + "Priority": 1, + "RenderExcludeTags": "", + "RenderTags": "", + "TargetEye": "None", + "Viewport": "0,0,1,1", + "ZFar": 32768, + "ZNear": 10 + } + ], + "Children": [ + { + "__guid": "c51bcc79-401c-446e-ad03-8bc8df117858", + "__version": 1, + "Flags": 0, + "Name": "LookAt", + "Position": "200,0,0", + "Rotation": "0,0,0,1", + "Scale": "1,1,1", + "Tags": "", + "Enabled": true, + "NetworkMode": 2, + "NetworkInterpolation": true, + "NetworkOrphaned": 0, + "OwnerTransfer": 1, + "Components": [], + "Children": [] + } + ] + } + ] } ] }, diff --git a/Code/Player/Dedugan.Camera.cs b/Code/Player/Dedugan.Camera.cs index c715c74..45e9a1c 100644 --- a/Code/Player/Dedugan.Camera.cs +++ b/Code/Player/Dedugan.Camera.cs @@ -2,54 +2,19 @@ public sealed partial class Dedugan { - private float anotherPivot; - private Vector3 pivotOffset; private void RotateCamera() { - if ( Input.Keyboard.Pressed( "Q" ) ) - { - anotherPivot = 40f; - } - - if ( Input.Keyboard.Pressed( "E" ) ) - { - anotherPivot = 0; - } - - - - if (RagdollController.Enabled) + if ( RagdollController.Enabled ) { var off = RagdollController.WorldRotation.Up * 20f - Camera.WorldRotation.Forward * 200f; - Camera.WorldPosition = Vector3.Lerp(Camera.WorldPosition, RagdollController.WorldPosition + off, Time.Delta * 5f); - Camera.LocalRotation = Rotation.Lerp(Camera.LocalRotation, EyeAngles.ToRotation(), Time.Delta * 2f); + Camera.WorldPosition = Vector3.Lerp( Camera.WorldPosition, RagdollController.WorldPosition + off, + Time.Delta * 5f ); + Camera.LocalRotation = Rotation.Lerp( Camera.LocalRotation, EyeAngles.ToRotation(), Time.Delta * 2f ); } else { - // Camera.LocalRotation = EyeAngles.ToRotation(); - // var offset = CameraPivot.LocalPosition + CameraPivot.LocalRotation.Backward * CamOffsetX; - // Camera.LocalPosition = offset * Camera.LocalRotation; - - Camera.LocalRotation = EyeAngles.ToRotation(); - - - var localPitchOffset = Camera.LocalRotation.Down * MathF.Max( 0f, EyeAngles.pitch ) * 0.32f + - Camera.LocalRotation.Backward * MathF.Max( 0f, EyeAngles.pitch ) * 0.7f + - Camera.LocalRotation.Up * MathF.Min( 0f, EyeAngles.pitch ) * 0.5f + - Camera.LocalRotation.Backward * MathF.Min( 0f, EyeAngles.pitch ) * 0.8f + - Camera.LocalRotation.Right * -anotherPivot; - - if ( InAds ) - { - pivotOffset = CameraPivot.LocalRotation.Backward * CamOffsetX * 0.5f + CameraPivot.LocalRotation.Up * 8f; - } - else - { - pivotOffset = CameraPivot.LocalRotation.Backward * CamOffsetX; - } - - var offset = (CameraPivot.LocalPosition + pivotOffset ) * EyeAngles.ToRotation() + localPitchOffset; - Camera.LocalPosition = offset; + CameraPivot.WorldPosition = Eyes.WorldPosition; + CameraPivot.LocalRotation = EyeAngles.ToRotation(); } } } diff --git a/Code/Player/Dedugan.Inventory.cs b/Code/Player/Dedugan.Inventory.cs index 765b9ed..41c0a8f 100644 --- a/Code/Player/Dedugan.Inventory.cs +++ b/Code/Player/Dedugan.Inventory.cs @@ -214,15 +214,15 @@ public sealed partial class Dedugan : Component if ( weapon != null && !weapon.IsReloading ) { weapon.StartReload(); - + // Анимация перезарядки персонажа (скорость уже установлена в weapon.StartReload()) // Дополнительно устанавливаем здесь на случай, если weapon.StartReload() не вызвался var weaponDef = weapon.GetWeaponDefinition(); if ( weaponDef != null ) { float reloadSpeed = weaponDef.ReloadTime > 0 ? 1f / weaponDef.ReloadTime : 1f; - Renderer.Set( "b_reload", true ); - Renderer.Set( "speed_reload", reloadSpeed ); + + Reload( reloadSpeed ); } } } @@ -312,17 +312,11 @@ public sealed partial class Dedugan : Component { Renderer.Set( "b_attack", true ); } + + [Rpc.Broadcast] + void Reload( float reloadSpeed ) + { + Renderer.Set( "b_reload", true ); + Renderer.Set( "speed_reload", reloadSpeed ); + } } - - -// if ( !Network.IsOwner ) return; -// -// InAds = Input.Down( "Attack2" ); -// -// if ( Input.Pressed( "Attack1" ) && _weapon != null ) -// { -// _weapon.Attack(); -// Attack(); -// } -// } -// diff --git a/Code/Player/Dedugan.cs b/Code/Player/Dedugan.cs index 7a98468..1189da4 100644 --- a/Code/Player/Dedugan.cs +++ b/Code/Player/Dedugan.cs @@ -13,9 +13,10 @@ public sealed partial class Dedugan : Component, IUseContext, Component.INetwork [Property] public SkinnedModelRenderer Renderer { get; set; } [Property] public GameObject Camera { get; set; } [Property] public GameObject CameraPivot { get; set; } + [Property] public GameObject Eyes { get; set; } [Property] public GameObject InventoryUI { get; set; } - [Property] [Range( 1f, 200f, 1f )] public float CamOffsetX { get; set; } + [Property] public Vector3 CamOffset { get; set; } [Property] [Range( 50f, 1200f, 10f )] public float WalkSpeed { get; set; } = 100f; [Property] [Range( 100f, 1500f, 20f )] public float RunSpeed { get; set; } = 300f; [Property] [Range( 25f, 1100f, 5f )] public float DuckSpeed { get; set; } = 50f; @@ -84,17 +85,15 @@ public sealed partial class Dedugan : Component, IUseContext, Component.INetwork UpdateBodyRotation(); - // Renderer.LocalRotation = Rotation.Slerp(Renderer.LocalRotation, Rotation.FromYaw(EyeAngles.yaw), Time.Delta * 5f); - Camera.LocalRotation = EyeAngles.ToRotation(); - var pivotOffset = CameraPivot.LocalRotation.Backward * CamOffsetX; - var localPitchOffset = Camera.LocalRotation.Down * MathF.Max( 0f, EyeAngles.pitch ) * 0.32f + - Camera.LocalRotation.Backward * MathF.Max( 0f, EyeAngles.pitch ) * 0.7f + - Camera.LocalRotation.Up * MathF.Min( 0f, EyeAngles.pitch ) * 0.5f + - Camera.LocalRotation.Backward * MathF.Min( 0f, EyeAngles.pitch ) * 0.8f; - var offset = (CameraPivot.LocalPosition + pivotOffset) * EyeAngles.ToRotation() + localPitchOffset; - Camera.LocalPosition = offset; + var pivotOffset = CameraPivot.LocalRotation.Right * CamOffset.y + + CameraPivot.LocalRotation.Forward * CamOffset.x + + CameraPivot.LocalRotation.Up * CamOffset.z; + + var rotatedOffset = pivotOffset * EyeAngles.ToRotation(); + + Camera.WorldPosition = CameraPivot.WorldPosition + rotatedOffset; } } @@ -129,13 +128,25 @@ public sealed partial class Dedugan : Component, IUseContext, Component.INetwork // Проверяем, нужно ли поворачивать тело bool shouldRotateBody = false; - + + if ( InAds ) { - // В режиме прицеливания - мертвая зона 85 градусов - if ( angleDiff > 85f ) + if ( Controller.Velocity.Length > 10f ) { - shouldRotateBody = true; + // При беге - центрируем тело (угол > 15°) + if ( angleDiff > 15f ) + { + shouldRotateBody = true; + } + } + else + { + // При стоянии - мертвая зона 85° + if ( angleDiff > 85f ) + { + shouldRotateBody = true; + } } } else diff --git a/Code/Weapons/README.md b/Code/Weapons/README.md index 56c5337..19710c1 100644 --- a/Code/Weapons/README.md +++ b/Code/Weapons/README.md @@ -73,6 +73,16 @@ - Настройка происходит прямо в инстансе префаба - Компоненты добавляются автоматически +### 7. Логика вращения в ADS режиме +- **При беге (velocity > 10)**: Тело центрируется при угле > 15° (как в обычном режиме) +- **При стоянии на месте**: Мертвая зона 85° - тело поворачивается только при угле > 85° +- **Синхронизация**: Логика работает одинаково для всех игроков + +### 8. Синхронизация анимаций +- **Перезарядка**: Анимации перезарядки синхронизированы по сети +- **RPC вызовы**: StartReload и FinishReload используют [Rpc.Broadcast] +- **Скорость анимации**: speed_reload параметр синхронизирован для всех игроков + ## Практическое использование ### 1. Создание оружия в редакторе