Переписал трение на пасейку (говно)

This commit is contained in:
Valera
2025-06-12 22:56:47 +07:00
parent 316c28b86d
commit 0ff82f3eac
10 changed files with 292 additions and 170 deletions

View File

@@ -6,6 +6,7 @@ namespace VeloX;
public partial class VeloXCar
{
[Property, Feature( "Engine" ), Sync] public EngineState EngineState { get; set; }
[Property, Feature( "Engine" )] public EngineStream Stream { get; set; }
public EngineStreamPlayer StreamPlayer { get; set; }
@@ -181,7 +182,6 @@ public partial class VeloXCar
if ( currentGear < 0 && ForwardSpeed < -100 )
return;
if ( Math.Abs( avgForwardSlip ) > 10 )
return;
@@ -351,8 +351,4 @@ public partial class VeloXCar
IsRedlining = (isRedlining && inputThrottle > 0);
}
public void StreamEngineUpdate()
{
}
}

View File

@@ -7,17 +7,11 @@ namespace VeloX;
[Title( "VeloX - Car" )]
public partial class VeloXCar : VeloXBase
{
protected override void OnAwake()
{
base.OnAwake();
StreamPlayer = new( Stream );
}
protected override void OnStart()
{
base.OnStart();
if ( !IsProxy )
StreamPlayer = new( Stream );
if ( IsDriver )
{
UpdateGearList();
UpdatePowerDistribution();
@@ -35,26 +29,24 @@ public partial class VeloXCar : VeloXBase
StreamPlayer.EngineState = EngineState;
StreamPlayer.IsRedlining = IsRedlining;
if ( Driver.IsValid() && Driver.IsProxy )
StreamPlayer.Update( Time.Delta, Scene.Camera.WorldPosition );
else
StreamPlayer.Update( Time.Delta, WorldPosition );
StreamPlayer.Update( Time.Delta, WorldPosition );
}
}
protected override void OnFixedUpdate()
{
if ( IsProxy )
if ( !IsDriver )
return;
base.OnFixedUpdate();
Brake = Math.Clamp( frontBrake + rearBrake + (Input.Down( "Jump" ) ? 1 : 0), 0, 1 );
var dt = Time.Delta;
EngineThink( dt );
WheelThink( dt );
UpdateSteering( dt );
Brake = Math.Clamp( frontBrake + rearBrake + (Input.Down( "Jump" ) ? 1 : 0), 0, 1 );
}
}