уже лучше
This commit is contained in:
@@ -17,7 +17,7 @@ public class PacejkaWidget : ControlObjectWidget
|
||||
Layout = Layout.Column();
|
||||
Layout.Margin = 8f;
|
||||
Layout.Spacing = 8;
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.LateralForce>().Fields )
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.LateralForce>().Properties )
|
||||
{
|
||||
var row = Layout.AddRow();
|
||||
row.Spacing = 8;
|
||||
@@ -36,7 +36,7 @@ public class PacejkaWidget : ControlObjectWidget
|
||||
Layout = Layout.Column();
|
||||
Layout.Margin = 8f;
|
||||
Layout.Spacing = 8;
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.LongitudinalForce>().Fields )
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.LongitudinalForce>().Properties )
|
||||
{
|
||||
var row = Layout.AddRow();
|
||||
row.Spacing = 8;
|
||||
@@ -55,7 +55,7 @@ public class PacejkaWidget : ControlObjectWidget
|
||||
Layout = Layout.Column();
|
||||
Layout.Margin = 8f;
|
||||
Layout.Spacing = 8;
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.AligningMoment>().Fields )
|
||||
foreach ( var item in TypeLibrary.GetType<Pacejka.AligningMoment>().Properties )
|
||||
{
|
||||
var row = Layout.AddRow();
|
||||
row.Spacing = 8;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using Editor;
|
||||
using Editor.Assets;
|
||||
using Editor.Inspectors;
|
||||
using Editor.ShaderGraph.Nodes;
|
||||
using Sandbox;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -68,16 +67,13 @@ class TirePresetPreview( Asset asset ) : PixmapAssetPreview( asset )
|
||||
for ( float x = x0; x <= xn; x += (xn - x0) / points )
|
||||
{
|
||||
|
||||
float yval = tire.PacejkaFy( x, load, Camber, 1.0f, out float maxforce ) / load;
|
||||
float yval = tire.PacejkaFy( x, load, Camber, 1.0f, out float _ ) / load;
|
||||
float xval = width * (x - x0) / (xn - x0);
|
||||
yval /= ymax - ymin;
|
||||
yval = (yval + 1.0f) * 0.5f;
|
||||
yval = 1.0f - yval;
|
||||
yval *= height;
|
||||
if ( x == x0 )
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
else
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
}
|
||||
|
||||
Paint.DrawLine( pointCache );
|
||||
@@ -86,6 +82,29 @@ class TirePresetPreview( Asset asset ) : PixmapAssetPreview( asset )
|
||||
{ // draw longitudinal line
|
||||
pointCache.Clear();
|
||||
|
||||
Paint.SetPen( Color.Green, 1 );
|
||||
float x0 = -zoom * 0.5f;
|
||||
float xn = zoom * 0.5f;
|
||||
float ymin = -1000.0f;
|
||||
float ymax = 1000.0f;
|
||||
int points = 500;
|
||||
|
||||
for ( float x = x0; x <= xn; x += (xn - x0) / points )
|
||||
{
|
||||
float yval = tire.PacejkaFx( x, load, 1.0f, out var _ ) / load;
|
||||
float xval = width * (x - x0) / (xn - x0);
|
||||
yval /= ymax - ymin;
|
||||
yval = (yval + 1.0f) * 0.5f;
|
||||
yval = 1.0f - yval;
|
||||
yval *= height;
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
}
|
||||
Paint.DrawLine( pointCache );
|
||||
}
|
||||
|
||||
{ // draw aligning line
|
||||
pointCache.Clear();
|
||||
|
||||
Paint.SetPen( Color.Blue, 1 );
|
||||
float x0 = -zoom * 0.5f * 10.0f;
|
||||
float xn = zoom * 0.5f * 10.0f;
|
||||
@@ -101,36 +120,7 @@ class TirePresetPreview( Asset asset ) : PixmapAssetPreview( asset )
|
||||
yval = (yval + 1.0f) * 0.5f;
|
||||
yval = 1.0f - yval;
|
||||
yval *= height;
|
||||
if ( x == x0 )
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
else
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
}
|
||||
Paint.DrawLine( pointCache );
|
||||
}
|
||||
|
||||
{ // draw aligning line
|
||||
pointCache.Clear();
|
||||
|
||||
Paint.SetPen( Color.Green, 1 );
|
||||
float x0 = -zoom * 0.5f;
|
||||
float xn = zoom * 0.5f;
|
||||
float ymin = -1000.0f;
|
||||
float ymax = 1000.0f;
|
||||
int points = 500;
|
||||
|
||||
for ( float x = x0; x <= xn; x += (xn - x0) / points )
|
||||
{
|
||||
float yval = tire.PacejkaFx( x, load, 1.0f ) / load;
|
||||
float xval = width * (x - x0) / (xn - x0);
|
||||
yval /= ymax - ymin;
|
||||
yval = (yval + 1.0f) * 0.5f;
|
||||
yval = 1.0f - yval;
|
||||
yval *= height;
|
||||
if ( x == x0 )
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
else
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
pointCache.Add( new( xval, yval ) );
|
||||
}
|
||||
Paint.DrawLine( pointCache );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user