Skip to content

Commit 9a76ff4

Browse files
committed
Fixed some bugs
1 parent 035cf52 commit 9a76ff4

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

Src/CameraData.cs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,25 @@ public class CameraData
2626
public float MinTime;
2727
public float MaxTime;
2828

29+
public Vector3 SmoothedPositionBinding = Vector3.zero;
30+
public Vector3 SmoothedLookAtBinding = Vector3.zero;
31+
2932
public Vector3 EvaluatePositionBinding(PluginCameraHelper helper)
3033
{
31-
return EvaluateBinding(helper, PositionBinding) + PositionOffset;
34+
var newPos = EvaluateBinding(helper, PositionBinding) + PositionOffset;
35+
36+
var filter = 0.05f;
37+
SmoothedPositionBinding = SmoothedPositionBinding * (1.0f - filter) + newPos * filter;
38+
return SmoothedPositionBinding;
3239
}
3340

3441
public Vector3 EvaluateLookAtBindingBinding(PluginCameraHelper helper)
3542
{
36-
return EvaluateBinding(helper, LookAtBinding) + LookAt;
43+
var newLookat = EvaluateBinding(helper, LookAtBinding) + LookAt;
44+
45+
var filter = 0.05f;
46+
SmoothedLookAtBinding = SmoothedLookAtBinding * (1.0f - filter) + newLookat * filter;
47+
return SmoothedLookAtBinding;
3748
}
3849

3950
Vector3 EvaluateBinding(PluginCameraHelper helper, string binding)
@@ -62,9 +73,6 @@ public static void LoadSettings()
6273
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
6374
string settingLoc = Path.Combine(docPath, @"LIV\Plugins\CameraBehaviours\FriesBSCam\");
6475

65-
// Create the directory in the off-chance that it doesn't exist.
66-
Directory.CreateDirectory(settingLoc);
67-
6876
settingLoc = Path.Combine(settingLoc, "settings.txt");
6977

7078
// Check to see if the file exists.
@@ -105,7 +113,7 @@ public static void LoadSettings()
105113
ws.WriteLine(" Name='BottomRight'");
106114
ws.WriteLine(" Type='LookAt'");
107115
ws.WriteLine(" PositionBinding='playerWaist'");
108-
ws.WriteLine(" PositionOffset={x='1.0', y='0.0', z='-2.0'} ");
116+
ws.WriteLine(" PositionOffset={x='0.75', y='0.0', z='-2.0'} ");
109117
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='1.0'} ");
110118
ws.WriteLine(" MinTime='4.0' ");
111119
ws.WriteLine(" MaxTime='8.0' ");
@@ -114,7 +122,7 @@ public static void LoadSettings()
114122
ws.WriteLine(" Name='BottomLeft'");
115123
ws.WriteLine(" Type='LookAt'");
116124
ws.WriteLine(" PositionBinding='playerWaist'");
117-
ws.WriteLine(" PositionOffset={x='-1.0', y='0.0', z='-2.0'} ");
125+
ws.WriteLine(" PositionOffset={x='-0.75', y='0.0', z='-2.0'} ");
118126
ws.WriteLine(" LookAt={x='0.0', y='0.0', z='1.0'} ");
119127
ws.WriteLine(" MinTime='4.0' ");
120128
ws.WriteLine(" MaxTime='8.0' ");

Src/MyCameraPlugin.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ public void OnActivate(PluginCameraHelper helper)
8383
{
8484
string docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
8585
string outputLoc = Path.Combine(docPath, @"LIV\Plugins\CameraBehaviours\FriesBSCam\");
86+
87+
// Create the directory in the off-chance that it doesn't exist.
88+
Directory.CreateDirectory(outputLoc);
89+
8690
outputLoc = Path.Combine(outputLoc, "output.txt");
8791
logStream = new StreamWriter(outputLoc);
8892

@@ -99,7 +103,7 @@ public void OnActivate(PluginCameraHelper helper)
99103

100104
public static void Log(string s)
101105
{
102-
if (false)
106+
if (true)
103107
{
104108
logStream.WriteLine(s);
105109
logStream.Flush();

0 commit comments

Comments
 (0)