This commit is contained in:
opti1337 2024-10-30 03:03:27 +03:00
parent 3255886197
commit f6ac6dd67c
5 changed files with 31 additions and 10 deletions

View File

@ -58,7 +58,7 @@
{
"__type": "AnimationHelper",
"__guid": "536068a6-fe5d-4f45-af74-9522ebf7e663",
"BodyWeight": 0,
"BodyWeight": 1,
"EyesWeight": 0,
"HeadWeight": 1,
"LookAtEnabled": true,
@ -68,6 +68,16 @@
"go": "b99ceffc-a173-4a6e-a239-6d3c1612c09f",
"component_type": "SkinnedModelRenderer"
}
},
{
"__type": "PlayerDresser",
"__guid": "9e0e0634-d503-4286-ace6-a8b6f1303e94",
"BodyRenderer": {
"_type": "component",
"component_id": "4fd8c36d-180b-41af-8439-6b975ca1c7b3",
"go": "b99ceffc-a173-4a6e-a239-6d3c1612c09f",
"component_type": "SkinnedModelRenderer"
}
}
],
"Children": [

View File

@ -59,10 +59,6 @@ public sealed class AnimationHelper : Component, Component.ExecuteInEditor
{
if ( !Target.IsValid() )
return;
AimBodyWeight = 0f;
AimEyesWeight = 0f;
AimHeadWeight = 1f;
if ( LookAtEnabled )
@ -126,9 +122,9 @@ public sealed class AnimationHelper : Component, Component.ExecuteInEditor
/// </summary>
public void WithLook( Vector3 lookDirection, float eyesWeight = 1.0f, float headWeight = 1.0f, float bodyWeight = 1.0f )
{
// Target.SetLookDirection( "aim_eyes", lookDirection, eyesWeight );
Target.SetLookDirection( "aim_eyes", lookDirection, eyesWeight );
Target.SetLookDirection( "aim_head", lookDirection, headWeight );
// Target.SetLookDirection( "aim_body", lookDirection, bodyWeight );
Target.SetLookDirection( "aim_body", lookDirection, bodyWeight );
}
/// <summary>

View File

@ -56,7 +56,7 @@ public sealed class Kal : Component
if ( Input.Pressed( "Jump" ) && Controller.IsOnGround )
{
Controller.Punch( Vector3.Up * JumpStrength * 2f );
Controller.Punch( Vector3.Up * JumpStrength );
AnimationHelper.TriggerJump();
}
@ -79,7 +79,7 @@ public sealed class Kal : Component
if ( Network.IsOwner )
{
EyeAngles += Input.AnalogLook;
EyeAngles = EyeAngles.WithPitch(MathX.Clamp(EyeAngles.pitch, -10f, 40f));
EyeAngles = EyeAngles.WithPitch(MathX.Clamp(EyeAngles.pitch, -90f, 70f));
// Renderer.WorldRotation = Rotation.Slerp(Renderer.WorldRotation, Rotation.FromYaw(EyeAngles.yaw), Time.Delta * 5f);
var cameraOffset = Vector3.Up * CamOffsetZ + Vector3.Backward * CamOffsetX;

14
Code/PlayerDresser.cs Normal file
View File

@ -0,0 +1,14 @@
using Sandbox;
public class PlayerDresser : Component, Component.INetworkSpawn
{
[Property]
public SkinnedModelRenderer BodyRenderer { get; set; }
public void OnNetworkSpawn( Connection owner )
{
var clothing = new ClothingContainer();
clothing.Deserialize( owner.GetUserData( "avatar" ) );
clothing.Apply( BodyRenderer );
}
}

View File

@ -24,6 +24,7 @@
"CsProjName": "",
"StartupScene": "scenes/minimal.scene",
"MapStartupScene": "scenes/minimal.scene",
"LaunchMode": "Normal"
"LaunchMode": "Normal",
"DedicatedServerStartupScene": "scenes/minimal.scene"
}
}