dedicated
This commit is contained in:
@@ -15,7 +15,7 @@ public class Transmission : PowertrainComponent
|
||||
/// <summary>
|
||||
/// A class representing a single ground surface type.
|
||||
/// </summary>
|
||||
public partial class TransmissionGearingProfile
|
||||
public class TransmissionGearingProfile
|
||||
{
|
||||
/// <summary>
|
||||
/// List of forward gear ratios starting from 1st forward gear.
|
||||
|
||||
@@ -4,8 +4,10 @@ namespace VeloX;
|
||||
|
||||
public abstract partial class VeloXBase
|
||||
{
|
||||
internal InputResolver Input { get; set; } = new();
|
||||
public Connection Driver { get => Input.Driver; set => Input.Driver = value; }
|
||||
internal readonly InputResolver Input = new();
|
||||
|
||||
public Guid DriverId { get; set; }
|
||||
public Connection Driver => Connection.Find( DriverId );
|
||||
|
||||
public bool IsDriver => Connection.Local == Driver;
|
||||
private bool IsDriverActive => Driver is not null;
|
||||
@@ -109,18 +111,25 @@ public abstract partial class VeloXBase
|
||||
protected void UpdateInput()
|
||||
{
|
||||
//VerticalInput = Input.AnalogMove.x;
|
||||
if ( IsDriverActive )
|
||||
{
|
||||
|
||||
Brakes = Input.Brake;
|
||||
Throttle = Input.Throttle;
|
||||
Brakes = Input.Brake;
|
||||
Throttle = Input.Throttle;
|
||||
|
||||
Handbrake = Input.Down( "Handbrake" ) ? 1 : 0;
|
||||
Handbrake = Input.Down( "Handbrake" ) ? 1 : 0;
|
||||
|
||||
SteeringAngle = Input.AnalogMove.y;
|
||||
SteeringAngle = Input.AnalogMove.y;
|
||||
|
||||
IsClutching = Input.Down( "Clutch" ) ? 1 : 0;
|
||||
IsClutching = Input.Down( "Clutch" ) ? 1 : 0;
|
||||
|
||||
IsShiftingUp = Input.Pressed( "Shift Up" );
|
||||
IsShiftingDown = Input.Pressed( "Shift Down" );
|
||||
IsShiftingUp = Input.Pressed( "Shift Up" );
|
||||
IsShiftingDown = Input.Pressed( "Shift Down" );
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetInput();
|
||||
}
|
||||
|
||||
if ( TotalSpeed < 150 && Driver is null )
|
||||
Handbrake = 1;
|
||||
|
||||
@@ -5,7 +5,6 @@ namespace VeloX;
|
||||
public abstract partial class VeloXBase
|
||||
{
|
||||
|
||||
private Vector3 linForce;
|
||||
private Vector3 angForce;
|
||||
protected const float BrakeForce = 4500f;
|
||||
protected const float HandbrakeForce = 35000f;
|
||||
@@ -13,18 +12,16 @@ public abstract partial class VeloXBase
|
||||
{
|
||||
if ( Body.Sleeping && Input.AnalogMove.x == 0 )
|
||||
return;
|
||||
//Body.PhysicsBody.SetInertiaTensor( new Vector3( 800000, 3000000, 6000000 ), Rotation.Identity );
|
||||
|
||||
var drag = AngularDrag;
|
||||
var mass = Body.Mass;
|
||||
var angVel = Body.AngularVelocity;
|
||||
|
||||
linForce.x = 0;
|
||||
linForce.y = 0;
|
||||
linForce.z = 0;
|
||||
|
||||
angForce = angForce.WithX( angVel.x * drag.x * mass * 1000 );
|
||||
angForce = angForce.WithY( angVel.y * drag.y * mass * 1000 );
|
||||
angForce = angForce.WithZ( angVel.z * drag.z * mass * 1000 );
|
||||
|
||||
if ( Wheels.Count > 0 )
|
||||
{
|
||||
Vector3 vehVel = Body.Velocity;
|
||||
@@ -58,8 +55,8 @@ public abstract partial class VeloXBase
|
||||
Body.AngularVelocity = vehAngVel;
|
||||
}
|
||||
|
||||
Body.ApplyForce( linForce );
|
||||
Body.ApplyTorque( angForce );
|
||||
//Body.ApplyForce( linForce );
|
||||
//Body.ApplyTorque( angForce );
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -56,10 +56,4 @@ public abstract partial class VeloXBase : Component, IGameObjectNetworkEvents
|
||||
PhysicsSimulate();
|
||||
}
|
||||
|
||||
//void IGameObjectNetworkEvents.NetworkOwnerChanged( Connection newOwner, Connection previousOwner )
|
||||
//{
|
||||
|
||||
// Driver = newOwner;
|
||||
// EngineIgnition = Driver is not null;
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ internal sealed class WheelManager : GameObjectSystem
|
||||
|
||||
public WheelManager( Scene scene ) : base( scene )
|
||||
{
|
||||
if ( Application.IsDedicatedServer )
|
||||
return;
|
||||
|
||||
Listen( Stage.StartFixedUpdate, -99, UpdateWheels, "UpdateWheels" );
|
||||
Listen( Stage.StartFixedUpdate, -100, UpdateEngine, "UpdateEngine" );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user