17 [
Attribute(
"0 0 1 1", UIWidgets.GraphDialog,
desc:
"Source data. X (horizontal) axis represents the vehicle speed in kph, Y (vertical) axis represents the amount of translation.")]
18 private ref Curve m_pCurveData;
23 [
Attribute(
"60.0", UIWidgets.Slider,
desc:
"The scale of curve in X axis, i.e. the speed of vehicle in kph we are sampling at.")]
24 private float m_fMaxSpeed;
28 [
Attribute(
"35.0", UIWidgets.Slider,
desc:
"The scale of curve in X axis, i.e. the speed of vehicle in kph we are sampling at (when in reverse).")]
29 private float m_fReverseMaxSpeed;
33 [
Attribute(
"1.2", UIWidgets.Slider,
desc:
"The scale of translation in local Z axis (forward), i.e. the forward translation of camera in meters based on the value we've sampled our speed at.",
params:
"-2 2 0.01")]
34 private float m_fForwardTranslationScale;
38 [
Attribute(
"-0.3", UIWidgets.Slider,
desc:
"The scale of translation in local Z axis (forward), i.e. the forward translation of camera in meters based on the value we've sampled our speed at (when in reverse).",
params:
"-2 2 0.01")]
39 private float m_fReverseForwardTranslationScale;
43 [
Attribute(
"-0.1", UIWidgets.Slider,
"The scale of translation in local Y axis (up), i.e. the up translation of camera in meters based on the value we've sampled our speed at.",
params:
"-2 2 0.01")]
44 private float m_fUpTranslationScale;
48 [
Attribute(
"200", UIWidgets.Slider,
"The scale of x-axis, i.e. maximum angular speed we're sampling at for the amount of aside translation.",
params:
"0.01 500 0.01")]
49 private float m_fAsideMaxAngularSpeed;
53 [
Attribute(
"0.1", UIWidgets.Slider,
"The scale of translation in local X axis (aside), i.e. the up translation of camera based on the value we've sampled our speed at.",
params:
"-10 10 0.01")]
54 private float m_fAsideTranslationScale;
60 float SampleAside(
float asideSpeed)
66 key = Math.Clamp(-asideSpeed / m_fAsideMaxAngularSpeed, 0.0, 1.0);
69 key = Math.Clamp(asideSpeed / m_fAsideMaxAngularSpeed, 0.0, 1.0);
71 float sample = Math3D.Curve(ECurveType.CatmullRom, key, m_pCurveData)[1] * m_fAsideTranslationScale;
82 vector Sample(
float speed)
87 float upScale = m_fUpTranslationScale;
88 float fwdScale = m_fForwardTranslationScale;
93 key = Math.Clamp(-speed / m_fReverseMaxSpeed, 0.0, 1.0);
94 fwdScale = m_fReverseForwardTranslationScale;
97 key = Math.Clamp(speed / m_fMaxSpeed, 0.0, 1.0);
99 float sample = Math3D.Curve(ECurveType.CatmullRom, key, m_pCurveData)[1];
100 return Vector(0, sample * upScale, sample * fwdScale);