Adding parabola movement path.

parent 4c5c01c3
......@@ -170,6 +170,22 @@ public class SceneController : MonoBehaviour
targetGO.transform.SetPositionAndRotation(position, orientation);
double speed = taskDict[participant]["components"].HasKey("speed") ? taskDict[participant]["components"]["speed"].AsDouble : 1.0;
// "Parabola"-like movement path
Vector3 midPointPosition = participantGO.transform.position + (targetGO.transform.position - participantGO.transform.position) / 2;
midPointPosition.y += 1f;
GameObject midPointGO = new GameObject($"Midpoint of {participant}");
SceneManager.MoveGameObjectToScene(midPointGO, SceneManager.GetSceneByName(contextScene));
midPointGO.transform.SetPositionAndRotation(midPointPosition, participantGO.transform.rotation);
GameObject rendererMid = new GameObject("RenderComponents");
rendererMid.transform.SetParent(midPointGO.transform);
rendererMid.transform.localScale = participantGO.transform.lossyScale;
rendererMid.transform.SetPositionAndRotation(midPointGO.transform.position, midPointGO.transform.rotation);
MeshFilter meshMid = rendererMid.AddComponent<MeshFilter>();
meshMid.mesh = participantGO.GetComponent<MeshFilter>().mesh;
MeshRenderer mrMid = rendererMid.AddComponent<MeshRenderer>();
mrMid.material = Resources.Load<Material>("Target");
Hashtable arguments = new Hashtable();
arguments["name"] = actionName;
arguments[mt.lookahead] = 0.01f;
......
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