30 lines
591 B
C#
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;
|
|
}
|
|
}
|