*
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user