32 lines
516 B
C#
32 lines
516 B
C#
using Sandbox;
|
|
|
|
namespace VeloX;
|
|
|
|
public abstract partial class VeloXBase
|
|
{
|
|
|
|
private Vector3 angForce;
|
|
|
|
private void PhysicsSimulate()
|
|
{
|
|
var drag = AngularDrag;
|
|
var mass = Body.Mass;
|
|
var angVel = Body.AngularVelocity;
|
|
|
|
angForce.x = angVel.x * drag.x * mass;
|
|
angForce.y = angVel.y * drag.y * mass;
|
|
angForce.z = angVel.z * drag.z * mass;
|
|
|
|
|
|
if ( Wheels.Count > 0 )
|
|
{
|
|
|
|
var dt = Time.Delta;
|
|
foreach ( var v in Wheels )
|
|
v.DoPhysics( this, in dt );
|
|
}
|
|
|
|
Body.ApplyTorque( angForce );
|
|
}
|
|
}
|