Skip to content

Commit

Permalink
jump as discrete event with animation
Browse files Browse the repository at this point in the history
  • Loading branch information
ataraciuk committed Apr 19, 2013
1 parent b027541 commit 00a850b
Show file tree
Hide file tree
Showing 239 changed files with 5,296 additions and 2,391 deletions.
2 changes: 1 addition & 1 deletion Assembly-CSharp-Editor-vs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp-Editor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp-firstpass-vs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp-firstpass.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
Binary file modified Assembly-CSharp-firstpass.pidb
Binary file not shown.
2 changes: 1 addition & 1 deletion Assembly-CSharp-vs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-CSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
Binary file modified Assembly-CSharp.pidb
Binary file not shown.
2 changes: 1 addition & 1 deletion Assembly-UnityScript-firstpass-vs.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-UnityScript-firstpass.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-UnityScript-vs.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion Assembly-UnityScript.unityproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>Temp\bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR</DefineConstants>
<DefineConstants>DEBUG;TRACE;UNITY_STANDALONE;ENABLE_MICROPHONE;ENABLE_IMAGEEFFECTS;ENABLE_WEBCAM;ENABLE_AUDIO_FMOD;ENABLE_NETWORK;ENABLE_MONO;ENABLE_PHYSICS;ENABLE_TERRAIN;ENABLE_CACHING;ENABLE_SUBSTANCE;ENABLE_GENERICS;ENABLE_CLOTH;ENABLE_MOVIES;ENABLE_AUDIO;ENABLE_WWW;ENABLE_SHADOWS;ENABLE_DUCK_TYPING;UNITY_4_0_1;UNITY_4_0;UNITY_STANDALONE_OSX;ENABLE_PROFILER;UNITY_EDITOR;UNITY_TEAM_LICENSE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<NoWarn>0169</NoWarn>
Expand Down
36 changes: 30 additions & 6 deletions Assets/Plugins/TSPS/OpenTSPSUnityListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,14 @@ public class OpenTSPSUnityListener : MonoBehaviour {
private float torsoYBeginning = -1.0f;
private float l_hip = -1.0f;
private float r_hip = -1.0f;
private float l_knee = -1.0f;
private float r_knee = -1.0f;
private float torso = -1.0f;
private float jumpCalibrated = -1.0f;
private float hipCalibrated = -1.0f;
private float neck = -1.0f;
private int consecutiveIncreases = 0;
private int jumpThreshold = 10;

public void OnEnable(){
UnityOSCReceiver.OSCMessageReceived += new UnityOSCReceiver.OSCMessageReceivedHandler(OSCMessageReceived);
Expand All @@ -58,32 +65,49 @@ public void Update(){
BroadcastMessage("HipsMoved", diff - hipCalibrated, SendMessageOptions.DontRequireReceiver);
hipCalibrated = diff;
}
if(torso >= 0.0f) {
if(jumpCalibrated < 0.0f) {
jumpCalibrated = torso;
}
BroadcastMessage("TorsoMoved", jumpCalibrated - torso, SendMessageOptions.DontRequireReceiver);
jumpCalibrated = torso;
}
if(l_knee >= 0.0f && r_knee >= 0.0f && neck >= 0.0f) {
BroadcastMessage("UpdateJumpThreshold", (l_knee + r_knee) / 2 - neck, SendMessageOptions.DontRequireReceiver);
}
}

public void OSCMessageReceived(OSC.NET.OSCMessage message){

string address = message.Address;
ArrayList args = message.Values;
if(address.StartsWith("/joint") && args[0].ToString() == "torso") {
if(address.StartsWith("/joint") && args[0].ToString() == "torso") {/*
if (torsoXBeginning == -1.0f) {
torsoXBeginning = (float)args[2];
}
if (torsoYBeginning == -1.0f) {
torsoYBeginning = (float)args[3];
}
BroadcastMessage("TorsoMoved", new Vector3(
((float)args[2] - torsoXBeginning),
(torsoYBeginning - (float)args[3]),
0), SendMessageOptions.DontRequireReceiver);
BroadcastMessage("TorsoMoved", torsoYBeginning - (float)args[3], SendMessageOptions.DontRequireReceiver);
torsoXBeginning = (float)args[2];
torsoYBeginning = (float)args[3];
torsoYBeginning = (float)args[3];*/
torso = (float)args[3];
}
if(address.StartsWith("/joint") && args[0].ToString() == "l_hip") {
l_hip = (float)args[2];
}
if(address.StartsWith("/joint") && args[0].ToString() == "r_hip") {
r_hip = (float)args[2];
}
if(address.StartsWith("/joint") && args[0].ToString() == "l_knee") {
l_knee = (float)args[3];
}
if(address.StartsWith("/joint") && args[0].ToString() == "r_knee") {
r_knee = (float)args[3];
}
if(address.StartsWith("/joint") && args[0].ToString() == "neck") {
neck = (float)args[3];
}
//Debug.Log("mouth width: "+mouthWidth+" mouth height: "+mouthHeight);
}
}
87 changes: 69 additions & 18 deletions Assets/Scripts/Move.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,23 @@ public class Move : MonoBehaviour {

private Vector3 Speed = Vector3.forward / 5;
private Vector3 startPos;
private float torsoZMultiplier = 200.0f;
private float hipsZMultiplier = 200.0f;
private float torsoYMultiplier = 50.0f;
private float alpha = 0.4f;
private List<float> speeds = new List<float>();
private List<float> velocities = new List<float>();
private int sampleBufferSize = 40;
private int sampleBufferSize = 80;
private List<float> torsoPos = new List<float>();
private int jumpLongBufferSize = 5;
private int jumpBufferSize = 5;
private float jumpThreshold = -1.0f;
private float jumpMult = 0.15f;
private bool jumping = false;
private float jumpHeight = 7.0f;
private float jumpTime = 0.2f;
private float jumpingSpeed = 0.0f;
private float endJumpTime = 0.0f;
private bool endedJump = false;

// Use this for initialization
void Start () {
Expand All @@ -21,32 +32,72 @@ void Start () {
speeds.Add(0.0f);
velocities.Add(0.0f);
}
for(int i = 0; i < jumpLongBufferSize; i++) {
torsoPos.Add(0.0f);
}
}

// Update is called once per frame
void Update () {
if(endedJump && Time.fixedTime > endJumpTime + 0.5f) {
jumping = false;
endedJump = false;
}
//this.transform.position += Speed;
//this.transform.position += Vector3.up * ( Mathf.Sin( Time.fixedTime * 1f ) * 0.3f);
}

void TorsoMoved(Vector3 torsoPos) {
// var absx = Mathf.Abs(torsoPos.x);
// //absx = alpha * absx + (1 - alpha) * backoff;
// speeds.RemoveAt(0);
// velocities.RemoveAt(0);
// speeds.Add(absx);
// velocities.Add(torsoPos.x);
// float mappedSpeed = Mathf.Log(1+ (speeds.Average() - Mathf.Abs(velocities.Average())));
// this.transform.position += new Vector3(0, /*torsoPos.y * torsoYMultiplier*/ 0, mappedSpeed * torsoZMultiplier);
void TorsoMoved(float val) {
torsoPos.RemoveAt(0);
torsoPos.Add(val);
if(jumpThreshold >= 0.0f && torsoPos.Sum() - torsoPos.Skip(sampleBufferSize - jumpBufferSize).Sum() > jumpThreshold * jumpMult) {
OnJump();
}
//this.transform.position += new Vector3(0, val * torsoYMultiplier, 0);
}
void HipsMoved(float val) {
var absx = Mathf.Abs(val);
//absx = alpha * absx + (1 - alpha) * backoff;
speeds.RemoveAt(0);
velocities.RemoveAt(0);
speeds.Add(absx);
velocities.Add(val);
if(!jumping) {
var absx = Mathf.Abs(val);
//absx = alpha * absx + (1 - alpha) * backoff;
speeds.RemoveAt(0);
velocities.RemoveAt(0);
speeds.Add(absx);
velocities.Add(val);
}
float mappedSpeed = Mathf.Log(1+ (speeds.Average() - Mathf.Abs(velocities.Average())));
this.transform.position += new Vector3(0, /*torsoPos.y * torsoYMultiplier*/ 0, mappedSpeed * torsoZMultiplier);
this.transform.position += new Vector3(0, /*torsoPos.y * torsoYMultiplier*/ 0, mappedSpeed * hipsZMultiplier);
}

void UpdateJumpThreshold(float val){
//Debug.Log(val);
jumpThreshold = val;
}

void OnJump() {
if(!jumping) {
jumping = true;
iTween.MoveAdd(this.gameObject, iTween.Hash(
"amount", Vector3.up * jumpHeight,
"time", jumpTime,
"easetype", iTween.EaseType.easeOutQuad,
"oncomplete", "Fall",
"oncompletetarget", this.gameObject
));
}
}

void Fall() {
iTween.MoveAdd(this.gameObject, iTween.Hash(
"amount", Vector3.down * jumpHeight,
"time", jumpTime,
"easetype", iTween.EaseType.easeInQuad,
"oncomplete", "FallComplete",
"oncompletetarget", this.gameObject
));
}

void FallComplete(){
endedJump = true;
endJumpTime = Time.fixedTime;
}
}
Binary file modified Assets/Standard Assets/Particles/Sources/Materials/Fire Add.mat
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-UnityScript.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/metadata/3c/3c251b7af806042a094e99f1c917bf1a
Binary file not shown.
Binary file modified Library/metadata/f7/f7a32129fcc6e42fab433b89ba254292
Binary file not shown.
2 changes: 1 addition & 1 deletion PCoSR-csharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
Expand Down
2 changes: 1 addition & 1 deletion PCoSR.sln
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
Expand Down
7 changes: 5 additions & 2 deletions PCoSR.userprefs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/Move.cs">
<Files>
<File FileName="Assets/Plugins/OSC.NET/UnityOSCReceiver.cs" Line="51" Column="21" />
<File FileName="Assets/Plugins/OSC.NET/UnityOSCReceiver.cs" Line="1" Column="1" />
<File FileName="Assets/Plugins/TSPS/OpenTSPSUnityListener.cs" Line="1" Column="1" />
<File FileName="Assets/Plugins/OSC.NET/jsOSCReceiver.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/Move.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/Move.cs" Line="21" Column="30" />
<File FileName="Assets/Scripts/CollisionLargeBdnf.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/CollisionSmallBdnf1.cs" Line="1" Column="1" />
<File FileName="Assets/Scripts/CollisionInhib.cs" Line="1" Column="1" />
<File FileName="Assets/Plugins/OSC.NET/jsOSCBundle.cs" Line="1" Column="1" />
<File FileName="Assets/Plugins/OSC.NET/jsOSCTransmitter.cs" Line="1" Column="1" />
<File FileName="Assets/Plugins/TSPS/OpenTSPSPerson.cs" Line="1" Column="1" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Editor/BuildScenes.cs'
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Scripts/CollisionInhib.cs'
'Assets/Scripts/CollisionLargeBdnf.cs'
'Assets/Scripts/CollisionSmallBdnf1.cs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Scripts/CollisionInhib.cs'
'Assets/Scripts/CollisionLargeBdnf.cs'
'Assets/Scripts/CollisionSmallBdnf1.cs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Scripts/CollisionInhib.cs'
'Assets/Scripts/CollisionLargeBdnf.cs'
'Assets/Scripts/CollisionSmallBdnf1.cs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Scripts/CollisionInhib.cs'
'Assets/Scripts/CollisionLargeBdnf.cs'
'Assets/Scripts/CollisionSmallBdnf1.cs'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Editor/BuildScenes.cs'
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,5 @@
-define:UNITY_STANDALONE_OSX
-define:ENABLE_PROFILER
-define:UNITY_EDITOR
-define:UNITY_TEAM_LICENSE
'Assets/Editor/BuildScenes.cs'
Loading

0 comments on commit 00a850b

Please sign in to comment.