Files

40 lines
685 B
C#
Raw Permalink Normal View History

2025-05-13 03:19:28 +03:00
using UnityEngine;
using System.Collections;
public class Plot3DMotorFunc : Plot3DFunction
{
public CarEngine engine;
public bool power;
public Car car;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public override float f(float x, float y)
{
if (engine == null)
{
return 0;
}
var t= (float)engine.GetTorque(Mathf.Clamp01(car.throlleCurve.Evaluate(y)), x);
if (!power)
{
return t;
}
return (float)MathEx.Power(t, MathEx.RpmToRadS * x) / 1000;
//return (x*x*y*y)*1000;
}
}