velox/Code/Base/Powertrain/PowerWheel.cs
2025-06-13 21:16:20 +07:00

30 lines
591 B
C#

using Sandbox;
using System;
namespace VeloX.Powertrain;
public class PowerWheel : PowertrainComponent
{
[Property] public VeloXWheel Wheel { get; set; }
public override float QueryInertia() => Wheel.Inertia;
public override float QueryAngularVelocity( float angularVelocity )
{
return Wheel.AngularVelocity;
}
public override float ForwardStep( float torque, float inertia )
{
Wheel.AutoPhysics = false;
Wheel.Torque = torque;
Wheel.Brake = Vehicle.Brake;
Wheel.DoPhysics( Vehicle );
angularVelocity = Wheel.AngularVelocity;
return Wheel.CounterTorque;
}
}