Commit 27c0b9cc authored by Chae Ho Shin's avatar Chae Ho Shin

trajectory movement WIP

parent 833ef0ae
...@@ -303,7 +303,7 @@ Transform: ...@@ -303,7 +303,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 4 m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &279236944 --- !u!114 &279236944
MonoBehaviour: MonoBehaviour:
...@@ -1064,7 +1064,7 @@ Transform: ...@@ -1064,7 +1064,7 @@ Transform:
m_Children: m_Children:
- {fileID: 439858922} - {fileID: 439858922}
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 6 m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &674390267 --- !u!1 &674390267
GameObject: GameObject:
...@@ -3472,7 +3472,7 @@ Transform: ...@@ -3472,7 +3472,7 @@ Transform:
m_LocalScale: {x: 1, y: 0.1000003, z: 1} m_LocalScale: {x: 1, y: 0.1000003, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 0} m_Father: {fileID: 0}
m_RootOrder: 5 m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!114 &1661408491 --- !u!114 &1661408491
MonoBehaviour: MonoBehaviour:
......
...@@ -46,7 +46,7 @@ public class BackgroundMovement : MonoBehaviour ...@@ -46,7 +46,7 @@ public class BackgroundMovement : MonoBehaviour
void FixedUpdate() void FixedUpdate()
{ {
if(!toggle) if(toggle)
{ {
transform.localPosition = new Vector3(0, 0, 0); transform.localPosition = new Vector3(0, 0, 0);
} }
......
...@@ -6,7 +6,7 @@ using MathNet.Numerics.LinearAlgebra.Double; ...@@ -6,7 +6,7 @@ using MathNet.Numerics.LinearAlgebra.Double;
public static class Constants public static class Constants
{ {
public static double c => 10; // speed of light. public static double c => 4; // speed of light.
public static double Gamma(double v) public static double Gamma(double v)
{ {
return 1.0f / Mathf.Sqrt((float)(1 - ((v / c) * (v / c)))); return 1.0f / Mathf.Sqrt((float)(1 - ((v / c) * (v / c))));
......
...@@ -22,6 +22,19 @@ public class PathRenderer : MonoBehaviour ...@@ -22,6 +22,19 @@ public class PathRenderer : MonoBehaviour
LineRenderer _pathRenderer; LineRenderer _pathRenderer;
float _originalPathColliderY; float _originalPathColliderY;
public BackgroundMovement Background
{
get
{
return background;
}
set
{
background = value;
}
}
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
...@@ -154,7 +167,7 @@ public class PathRenderer : MonoBehaviour ...@@ -154,7 +167,7 @@ public class PathRenderer : MonoBehaviour
/// 현재 설정된 경로의 속력을 반환. /// 현재 설정된 경로의 속력을 반환.
/// 0번은 0.0f /// 0번은 0.0f
/// </summary> /// </summary>
public List<float> PathVelocitys public List<float> PathVelocities
{ {
get get
{ {
...@@ -178,4 +191,15 @@ public class PathRenderer : MonoBehaviour ...@@ -178,4 +191,15 @@ public class PathRenderer : MonoBehaviour
_pathCollider.transform.localPosition = (square.pathList[n] + square.pathList[n + 1]) / 2; _pathCollider.transform.localPosition = (square.pathList[n] + square.pathList[n + 1]) / 2;
} }
public IEnumerator _StartMovingPath(int finalPathNum)
{
int i = 0;
while(i < finalPathNum)
{
yield return new WaitForFixedUpdate();
}
}
} }
...@@ -42,6 +42,9 @@ public class Planemovement : FlatlandMovement ...@@ -42,6 +42,9 @@ public class Planemovement : FlatlandMovement
{ {
cnt = 0; cnt = 0;
} }
alpha = 4 * Vector3.forward * Mathf.Cos(2 * Mathf.PI * cnt / 480) + 4 * Vector3.left * Mathf.Sin(2 * Mathf.PI * cnt / 480);
if (alpha.magnitude > 0.0f) if (alpha.magnitude > 0.0f)
{ {
...@@ -91,10 +94,7 @@ public class Planemovement : FlatlandMovement ...@@ -91,10 +94,7 @@ public class Planemovement : FlatlandMovement
v = levelManager.player.v; v = levelManager.player.v;
Debug.Log("being grabbed"); Debug.Log("being grabbed");
} }
else
{
v = new Vector3(0, 0, 0);
}
beta = v.magnitude / (float)Constants.c; beta = v.magnitude / (float)Constants.c;
......
...@@ -112,12 +112,6 @@ public class UIManager : MonoBehaviour ...@@ -112,12 +112,6 @@ public class UIManager : MonoBehaviour
prevSelectPathNum = pathNum; prevSelectPathNum = pathNum;
} }
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
} }
else else
{ {
...@@ -213,26 +207,12 @@ public class UIManager : MonoBehaviour ...@@ -213,26 +207,12 @@ public class UIManager : MonoBehaviour
/// </summary> /// </summary>
public void PathStart() public void PathStart()
{ {
bool result; pathRenderer.Background.Toggle = false;
var positions = pathRenderer.PathPositionsXZ; StartCoroutine(pathRenderer._StartMovingPath(prevSelectPathNum));
var velocitys = pathRenderer.PathVelocitys;
if(positions.Count<=1 || velocitys.Count <= 1)
{
return;
}
// remove dummy
positions.RemoveAt(0);
velocitys.RemoveAt(0);
result = levelManager.player.MoveToRetivePosition(positions,velocitys);
if (result)
{
pathRenderer.PathClear();
}
} }
public void OnDoubleClicked() public void OnDoubleClicked()
{ {
try try
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
--- !u!5 &1 --- !u!5 &1
TimeManager: TimeManager:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
Fixed Timestep: 0.01 Fixed Timestep: 0.005
Maximum Allowed Timestep: 0.1 Maximum Allowed Timestep: 0.1
m_TimeScale: 1 m_TimeScale: 1
Maximum Particle Timestep: 0.01 Maximum Particle Timestep: 0.005
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment