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

trajectory movement WIP

parent 833ef0ae
......@@ -303,7 +303,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &279236944
MonoBehaviour:
......@@ -1064,7 +1064,7 @@ Transform:
m_Children:
- {fileID: 439858922}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &674390267
GameObject:
......@@ -3472,7 +3472,7 @@ Transform:
m_LocalScale: {x: 1, y: 0.1000003, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
--- !u!114 &1661408491
MonoBehaviour:
......
......@@ -46,7 +46,7 @@ public class BackgroundMovement : MonoBehaviour
void FixedUpdate()
{
if(!toggle)
if(toggle)
{
transform.localPosition = new Vector3(0, 0, 0);
}
......
......@@ -6,7 +6,7 @@ using MathNet.Numerics.LinearAlgebra.Double;
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)
{
return 1.0f / Mathf.Sqrt((float)(1 - ((v / c) * (v / c))));
......
......@@ -22,6 +22,19 @@ public class PathRenderer : MonoBehaviour
LineRenderer _pathRenderer;
float _originalPathColliderY;
public BackgroundMovement Background
{
get
{
return background;
}
set
{
background = value;
}
}
// Start is called before the first frame update
void Start()
{
......@@ -154,7 +167,7 @@ public class PathRenderer : MonoBehaviour
/// 현재 설정된 경로의 속력을 반환.
/// 0번은 0.0f
/// </summary>
public List<float> PathVelocitys
public List<float> PathVelocities
{
get
{
......@@ -178,4 +191,15 @@ public class PathRenderer : MonoBehaviour
_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
{
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)
{
......@@ -91,10 +94,7 @@ public class Planemovement : FlatlandMovement
v = levelManager.player.v;
Debug.Log("being grabbed");
}
else
{
v = new Vector3(0, 0, 0);
}
beta = v.magnitude / (float)Constants.c;
......
......@@ -112,12 +112,6 @@ public class UIManager : MonoBehaviour
prevSelectPathNum = pathNum;
}
else
{
_pathUI.SetActive(false);
prevSelectPathNum = -1;
sliderflag = 0;
}
}
else
{
......@@ -213,25 +207,11 @@ public class UIManager : MonoBehaviour
/// </summary>
public void PathStart()
{
bool result;
var positions = pathRenderer.PathPositionsXZ;
var velocitys = pathRenderer.PathVelocitys;
if(positions.Count<=1 || velocitys.Count <= 1)
{
return;
pathRenderer.Background.Toggle = false;
StartCoroutine(pathRenderer._StartMovingPath(prevSelectPathNum));
}
// remove dummy
positions.RemoveAt(0);
velocitys.RemoveAt(0);
result = levelManager.player.MoveToRetivePosition(positions,velocitys);
if (result)
{
pathRenderer.PathClear();
}
}
public void OnDoubleClicked()
{
......
......@@ -3,7 +3,7 @@
--- !u!5 &1
TimeManager:
m_ObjectHideFlags: 0
Fixed Timestep: 0.01
Fixed Timestep: 0.005
Maximum Allowed Timestep: 0.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