25 lines
480 B
C#
25 lines
480 B
C#
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 )
|
|
foreach ( var v in Wheels )
|
|
if ( v.AutoPhysics ) v.DoPhysics( this );
|
|
|
|
Body.ApplyTorque( angForce );
|
|
}
|
|
}
|